...
Make sure you are using opensrp-client-core version >= v1.12.0-SNASPHOT
Make sure you are using opensrp-client-native-form version >= v.1.13.1-SNAPSHOT
Add the following code to the last line in your
Application.onCreate
methodCode Block NativeFormLibrary .getInstance() .setClientFormDao(CoreLibrary.getInstance().context().getClientFormRepository());
Change any references, extensions and manifest declarations of
com.vijay.jsonwizard.activities.JsonFormActivity
tocom.vijay.jsonwizard.activities.FormConfigurationJsonFormActivity
Change the
AndroidManifest.xml
declaration of theJsonFormActivity
toFormConfigurationJsonFormActivity
Change any
startActivity
andstartActivityForResult
methods to useFormConfigurationJsonFormActivity
instead ofJsonFormActivity
as the target activityReplace parent activities from
JsonFormActivity
toFormConfigurationJsonFormActivity
in the activities which extendJsonFormActivity
Add the following lines to your
AppJobCreator#onCreate
method to make theDocumentConfigurationServiceJob
availableCode Block language java case DocumentConfigurationServiceJob.TAG: return new DocumentConfigurationServiceJob(DocumentConfigurationIntentService.class);
Schedule the
DocumentConfigurationServiceJob
to run every 15 minutes by adding the following line toLoginInteractor#scheduleJobsPeriodically
Code Block DocumentConfigurationServiceJob .scheduleJob(DocumentConfigurationServiceJob.TAG , TimeUnit.MINUTES.toMillis(BuildConfig.CLIENT_SETTINGS_SYNC_MINUTES) , getFlexValue(BuildConfig.CLIENT_SETTINGS_SYNC_MINUTES));
Create the
ClientFormRepository
andManifestRepository
by adding the create statements in theApplicationRepository
eg.ANCRepository
or add the create statements as migrations. To create the tables, add the following statementsCode Block language java ClientFormRepository.createTable(db); ManifestRepository.createTable(db);
Add the forms sync to the immediate sync call. This function enables forms sync to happen when the user clicks on the Sync button
When openning opening forms, use
com.vijay.jsonwizard.utils.FormUtils#getFormJsonFromRepositoryOrAssets
method to fetch the JSON form. The rules & other assets required when loading the form are handled by the FormConfigurationJsonFormActivityMake an initial upload of the form files:
Clone this repo github.com/OpenSRP/opensrp-server-web
Change client project assets folder path in the configuration file named doc_config_script_configs.properties
Change the server url & authentication credentials in the configuration file named doc_config_script_configs.properties
Change the appId and appVersion values in the configuration file named doc_config_script_configs.properties
Run the main method in InitialFormConfigUploadUtil.java file
Check the output for any failures. Increment the formVersion and repeat in case of any failures
How it works
Changes to the form eg. child_enrollment.json, disease_effects.json are made and tested
Create a Manifest in json form with the package name, app version & forms version as below
...
GET request with params
form_version
(Required) The semantic version of the formform_identifier
(Required) The unique identifier of the form eg.en/json.form/maternity/enrollment.json
current_form_version
(Optional) The current form version on the client app
Client side APIs
Coming soon. This work is under development
...