Ir para o conteúdo
For the complete DHIS2 documentation index, see llms.txt.

Settings

As configurações são baixadas em cada sincronização de metadados. Existem diferentes tipos de configurações:

d2.settingModule()
  • System settings: system-wide properties such as flag or keyCustomColorMobile (note: style has been deprecated in favour of keyCustomColorMobile).
  • Configurações do usuário: configurações específicas do usuário, como keyDbLocale oukeyUiLocale.
  • Aplicativo de configurações: essas configurações oferecem controle adicional sobre o comportamento do aplicativo. Mais sobre isso na próxima seção.

App de configurações

A instância DHIS2 pode incluir um aplicativo da web chamado "Configurações do Android" que permite ter controle remoto sobre determinados parâmetros do aplicativo. A instalação e configuração deste aplicativo é opcional.

This SDK downloads this configuration in every metadata synchronization and persist it in the database. Some of these parameters are automatically consumed by the SDK (they are marked in bold below), although most of them might be overridden by the app.

Configurações gerais

d2.settingModule().generalSetting()

It gives additional information about app settings:

  • Criptografar banco de dados: criptografar ou não o banco de dados local.
  • Reserved values: number of attribute values to reserve. It might be overridden by the app.
  • Bypass DHIS2 version: if true, the SDK will try to connect to the instance no matter the DHIS2 version installed.
  • Mobile configuration: gateway number, result sender number. They must be consumed by the application and used to configure the SMS module in the SDK.
  • Matomo configuration: if you have your own Matomo instance, you can expose this information to the app in order to configure its Matomo client.
  • AllowScreenCapture: parameter to determine if the application should allow screen capture or not.
  • MessageOfTheDay: a message to show to the users.
  • ExperimentalFeatures: list of experimental features enabled.

Configurações de sincronização

d2.settingModule().synchronizationSettings()

Oferece parâmetros adicionais para controlar a sincronização de metadados/dados.

  • MetadataSync, DataSync: esses dois parâmetros definem a periodicidade da sincronização de metadados/dados. Eles devem ser usados pelo aplicativo para criar trabalhos agendados.
  • TrackerImporterVersion: version of the tracker importer: V1 refers to the legacy tracker importer (/api/trackedEntityInstances endpoint); V2 refers to the importer introduced in 2.37 (/api/tracker endpoint).
  • ProgramSettings: esta seção controla os parâmetros de sincronização de dados do programa. Possui uma seção para definir os parâmetros globais ou padrão a serem usados na sincronização de todos os programas. Além disso, permite definir configurações específicas para programas específicos. Todos esses parâmetros são consumidos pelo SDK e usados no processo de sincronização.
  • DataSetsSettings: esta seção controla os parâmetros de sincronização de dados agregados. Possui uma secção para definir os parâmetros globais ou padrão a serem usados na sincronização de todos os dataSets. Além disso, permite definir configurações específicas para conjuntos de dados particulares. Todos esses parâmetros são consumidos pelo SDK e usados no processo de sincronização.

Configurações de aparência

d2.settingModule().appearanceSettings()

These settings give control over the appearance of the data entry form.

  • FilterSorting: it defines the filters that must be enabled in the different app menus.
  • ProgramConfiguration: it defines two properties for programs.
    • CompletionSpinner: show/hide the completion spinner.
    • OptionalSearch: it defines if searching is mandatory or not before creating data.
    • DisableReferrals: whether referrals must be enabled or not for this program.
    • DisableCollapsibleSections: whether the sections must be collapsible or not for this program.
    • ItemHeader: it defines the element (programIndicator) to be used to generate a header for the TEI. This property is automatically consumed by the SDK when using the TrackedEntitySearchCollectionRepository.
    • MinimumLocationAccuracy: it determines the precision when capturing coordinates.
    • DisableManualLocation: whether the coordinates can be captured manually.

Most of the settings refer to visual components so they are usually consumed by the app.

Analytic settings

d2.settingModule().analyticsSetting()

d2.settingModule().analyticsSetting().teis()

d2.settingModule().analyticsSetting().dhisVisualizations()

As configurações de analítica definem os elementos analíticos (gráficos, tabelas,...) que devem ser exibidos para o usuário.

  • coleção teis: definem elementos analíticos referentes ao contexto de um único TEI. Esses elementos devem ser exibidos em um painel TEI.
  • dhisVisualizations: são organizados em três seções (home, program, dataSet) e cada secção é composta por uma lista de grupos. Cada grupo contém uma lista de visualizações. Sobre as secções:
    • home: those visualizations that must be displayed in the home screen.
    • program: map of objects with the key being a programId. These visualizations are intended to be displayed in the context of a particular program.
    • dataSet: map of objects with the key being a dataSetId. These visualizations are intended to be displayed in the context of a particular dataSet.

These settings refer to visual components so they must be consumed by the app.

Custom intents

d2.settingModule().customIntents()

d2.settingModule().customIntentService()

Custom intents allow the Android Settings app to configure external integrations that can be triggered from within the app. These intents are downloaded during metadata synchronization and can be used to launch external applications or services with context-specific data.

Each custom intent configuration includes: - Trigger: Defines when and where the intent should be available (e.g., in TEI dashboard, enrollment, event, dataSet). - Action: The type of action to perform (e.g., launch activity, send broadcast). - Package name: The target application package. - Request: Configuration for data to send to the external app, with key-value arguments that can use expression-based values. - Response: Configuration for data to receive back from the external app.

The SDK provides a CustomIntentService to evaluate request parameters based on the current context:

// Get custom intents
List<CustomIntent> intents = d2.settingModule().customIntents()
    .blockingGet();

// Evaluate parameters for a specific context (optionally with orgunit)
CustomIntentContext context = new CustomIntentContext("orgunitUid");

Map<String, Object> params = d2.settingModule().customIntentService()
    .blockingEvaluateRequestParams(customIntent, context);