cordova-plugin-background-mode
cordova-plugin-background-mode copied to clipboard
Not Working on Android 10
I have installed Sample App on my Oneplus 7 Running Android 10. After clicking on Background button nothing happens notification is not visible as well.
Same problem with the "cordova-plugin-background-mode" plugin. (For mqtt I don't know because I don't have it in my project).
With the following permissions in the AndroidManifest:
- FOREGROUND_SERVICE
- SYSTEM_ALERT_WINDOW ==> User action ==> True
- REQUEST_IGNORE_BATTERY_OPTIMIZATIONS ==> User action ==> Authorize
The pugin works on all phones.
However, when I use the plugin's "excludeFromTaskList ()" function, this is different.
When the application goes to the background, the application is excluded from the task list, but when I open another application, it stops systematically. This is valid for versions 10 and + of Android.
Does anyone have a solution ?
EDIT :
- Already try : TheBosZ
Use this plugin ::
https://bitbucket.org/TheBosZ/cordova-plugin-run-in-background/src/master/
Yes I installed this plugin which is very useful with its "isIgnoringBatteryOptimizations" function and also for these two additional parameters in the "setDefault" function (channelName && channelDescription).
But unfortunately it did not solve my problem regarding the "excludeFromTaskList" function. The result is similar, on android 10 and above, as soon as I launch another application, mine in the background is automatically killed 👎🏻
So I gave up the idea of excluding it from this list and I content myself with the classic behavior.
@GhoshWorld Thank you. That plugin works !
I also had to update to cordova-android@9, install cordova-plugin-androidx-adapter
and add this to my config.xml <preference name="AndroidXEnabled" value="true" />
Yes I installed this plugin which is very useful with its "isIgnoringBatteryOptimizations" function and also for these two additional parameters in the "setDefault" function (channelName && channelDescription).
But unfortunately it did not solve my problem regarding the "excludeFromTaskList" function. The result is similar, on android 10 and above, as soon as I launch another application, mine in the background is automatically killed 👎🏻
So I gave up the idea of excluding it from this list and I content myself with the classic behavior.
I can confirm exactly the same beaviour. Any fix or workaround?