27
Views
3
Comments
 How can I trigger a sync every day at midnight 12 for the mobile app?
Question

Hello,

 Good day!

 How can I trigger a sync every day at midnight specific time for the mobile app?

UserImage.jpg
Supriya Malla

Hi @Priya Naveen

In typical scenarios, such as syncing data between server-side entities, it is possible to schedule the operation using a Timer.

But here, we're specifically talking about mobile sync, which only works when the mobile app is active. Mobile apps in OutSystems cannot execute background processes like syncing at a fixed scheduled time (e.g., midnight). So, triggering a sync automatically at a specific time is not possible unless the app is open or resumed by the user.

However, we can trigger the sync automatically under these conditions:

  • SyncOnResume: When the user resumes the app.

  • SyncOnOnline: When the user comes online after opening the app.

  • SyncOnLogin: When the user logs into the app.

Hope this helps!

Thanks,

Supriya

2016-04-22 00-29-45
Nuno Reis
 
MVP

On a side note, if the app stays open, you can calculate time until midnight (either seconds or hours) and with JS and setTimeout schedule the sync.

This is not a common scenario, but should work.

Still, this is an idea for a single device approach. You don't want to force every single one of your online users to sync on the same second and wait for the server to process everything and send to everyone.

For multiple users SyncOnOnline is ideal as when they open the app they get the data. Even if they start work at the same time, it will not be on the same exact second.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.