Sync metadata on every login in Android app

Hello experts,
In a special situation, I need to sync metadata while every successful login into the android app. I researched for a few days but ended up with no luck. So, I have come here for your expert opinions.

I have downloaded the current android sdk into android studio. Looking forward to getting support from the community. (N.B. I am very new to android development environment)

Regards…

1 Like

Hi @riaz.somc

Thank you for your post! Usually the metadata doesn’t change this fast so it’d be very interesting to know the use case please.

I’m not sure if this will actually work but using the datastore management app, it’s possible to change the android synchronization option for metadata sync to be 1h (0.5h). Is that enough?

But like I said, I’m not sure it’ll work so maybe someone from the @dhis2-android team could confirm (@jaime.bosque @nancyesp :pray:)

1 Like

Hello @riaz.somc ,

Can I know why you would like to update the metadata so often? As @Gassim is pointing in the previous response the metadata is not something that changes often so there should be no need for that. In any case, it is not possible to do it with every login.

You can set the frequency via the Android Settings WebApp as shown below:

Please note that it is not advised to change this directly via the Data Store as @Gassim is suggesting as this can lead easily to errors :slight_smile:

2 Likes

Thank you @Gassim and @jaime.bosque for your kind help. I have found the solution and have been able to modify LoginActivity.kt on the APK to achieve my purpose.

1 Like