karan vs
karan vs

Reputation: 3364

Syncing with server in specific interval at non-active hours

I want to sync the data with server between 12 am - 6 am only.

I have solutions like WorkManager and sync adapter at my disposal. But some manufactures put restrictions on these work managers and syncadapter also.

What is a sure shot solution that a network request will can be made between these non active hours(most users are not using the app) ?

Upvotes: 1

Views: 111

Answers (1)

Yavor Mitev
Yavor Mitev

Reputation: 1523

  1. There is no sure solution. This is Android. Every vendor can do whatever they like.
  2. What restrictions you are talking about? Because you are saying "some vendors"? In general Android applies restrictions related to how much time you can be executed per 24 hours period and how much network you can use. It is dependant on the Power Bucket you are in. And the Power Bucket itself depends on how often the user interacts with your app. Check here:

https://developer.android.com/topic/performance/power/power-details

  1. You can implement a dialog asking the user to exempt you from Battery Optimization. This will fix the restrictions on most vendors. Check here:

https://developer.android.com/training/monitoring-device-state/doze-standby#support_for_other_use_cases

Upvotes: 1

Related Questions