Android Question What can I do if Android phones regulates wifi connection time when screen lock

Rumin

Member
Licensed User
I've just finished my app, in which, I need to download varying texts every several minutes. Android phones (for example: Huawei) regulates wifi connection time when screen lock for power saving. That means, my app is running in the state of screen lock but no wifi connection, then cause error. I tried to use "Wake" or "Permission..." but I'm afraid my service will be killed. Any help? thank you in advance.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Starting a process every several minutes is problematic in newer versions of Android. The OS will not allow it.
A better approach will be to send a push message with the information.

You can use StartServiceAt to start a service every 15 or 30 minutes.
Make sure to start a service other than the starter service, make that service a foreground service and acquire a partial lock until you finish downloading.
 
Upvote 0
Top