Application running in Doze/Sleep Mode

I have a phonegapped app that is designed to run in the background (stays on all the time and uses wifi). Prior to Android PI this worked fine, but the option to allow wifi in sleep/doze mode is no longer available.

I have read that if i can set Wake Lock, Wifi Lock and Application whitelisted the app will work again, but open for suggestions or how to set these in Phonegap

Just had a quick look - you may need to set some Android permissions using another plugin:

It looks like it gets really tricky . According to this article Wifi Lock, Wake lock and whitelist are all needed
http://www.darryncampbell.co.uk/2018/07/09/keeping-your-application-running-when-the-device-wants-to-sleep-updated-for-android-p/

The wifilock is one I cant seem to get working

tried adding cordova-plugin-wifi-manager in config xml but keep getting an error

plugin name=“cordova-plugin-wifi-manager” source='npm"

I guess a bigger picture is how to know the correct syntax on these entries in config.xml. Some use
source='npm" and some use spec=“xx.x.xx” I tried using the spec and defined the version release defined in cordova documentation but always get an error.

It would help if you included the error message you are getting.

To update what I did to solve issue, added these 2 items to my project.
(so far works thru android 9.0)

power management option
'====================================
window.powermanagement.acquire(works,broke)
'GitHub - Viras-/cordova-plugin-powermanagement: Cordova PowerManagement plugin

Background Mode option
'====================================
'background mode
'cordova-plugin-background-mode/README.md at master · katzer/cordova-plugin-background-mode · GitHub
cordova.plugins.backgroundMode.enable

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.