cordova-plugin-background-mode icon indicating copy to clipboard operation
cordova-plugin-background-mode copied to clipboard

Not Working on Android 10

Open roushankumar01 opened this issue 3 years ago • 5 comments

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.

roushankumar01 avatar May 14 '21 07:05 roushankumar01

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 :

Maxime145 avatar Jul 06 '21 12:07 Maxime145

Use this plugin ::

https://bitbucket.org/TheBosZ/cordova-plugin-run-in-background/src/master/

GhoshWorld avatar Jul 20 '21 03:07 GhoshWorld

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.

Maxime145 avatar Jul 20 '21 07:07 Maxime145

@GhoshWorld Thank you. That plugin works !

I also had to update to cordova-android@9, install cordova-plugin-androidx-adapterand add this to my config.xml <preference name="AndroidXEnabled" value="true" />

AndreiTelteu avatar Sep 06 '21 09:09 AndreiTelteu

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?

Gabri1495 avatar Feb 02 '22 08:02 Gabri1495