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

Android 9 don't work

Open Electrobyte2 opened this issue 5 years ago • 13 comments
trafficstars

HI! i' have a phonegap application and for android-targetSdkVersion 27 works well. For android-targetSdkVersion 28 crash with background plugin. I put permissions in my config.xlm and dosen't work. Any someone have a solution?

config.xlm Head: `

 <platform name="android">
         <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
             <application android:usesCleartextTraffic="true" />

         </edit-config>


 </platform>

 <platform name="android">
         <edit-config file="app/src/main/AndroidManifest.xml" mode="merge" target="/manifest/application">
             <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

         </edit-config>


 </platform>`

Electrobyte2 avatar Jan 09 '20 16:01 Electrobyte2

This plugin doesn't update anymore. https://bitbucket.org/TheBosZ/cordova-plugin-run-in-background/src/master/ this fork works on android 9.

mooner1022 avatar Jan 10 '20 09:01 mooner1022

What is the change compared to this version?

ThorvaldAagaard avatar Jan 11 '20 22:01 ThorvaldAagaard

This one works for me https://www.npmjs.com/package/cordova-plugin-background-mode-fixed

JohannesPertl avatar Jan 17 '20 11:01 JohannesPertl

On both IOS and Android? I have been testing a lot, and it seems that on Android it works for some time 5+ hours and then it suddenly stops for no apparent reason

ThorvaldAagaard avatar Jan 17 '20 11:01 ThorvaldAagaard

Only on Android, I only use it for a simple timer app and didn't test it for more than a few minutes

JohannesPertl avatar Jan 17 '20 12:01 JohannesPertl

Could be interesting if you could test it running 24 hours

ThorvaldAagaard avatar Jan 17 '20 12:01 ThorvaldAagaard

I think it is also related to what device you are using. https://dontkillmyapp.com/

danielehrhardt avatar Jan 18 '20 01:01 danielehrhardt

I tried running it for 24 hours, it crashed after about 6. I'm using a Huawei phone, so that might be the reason

JohannesPertl avatar Jan 18 '20 09:01 JohannesPertl

It seems to be webview that is the problem. I have had an android native application running in the background for 3+ days now. But when starting the backgroundservice from a webview I ndver have seen it running more than 6-8 hours

ThorvaldAagaard avatar Jan 18 '20 22:01 ThorvaldAagaard

It seems to be webview that is the problem. I have had an android native application running in the background for 3+ days now. But when starting the backgroundservice from a webview I ndver have seen it running more than 6-8 hours

So the Plugin is Buggy.

danielehrhardt avatar Jan 19 '20 11:01 danielehrhardt

This plugin doesn't update anymore. https://bitbucket.org/TheBosZ/cordova-plugin-run-in-background/src/master/ this fork works on android 9.

Ok but this new plugin are compatible whith phonegap?

Electrobyte2 avatar Jan 20 '20 01:01 Electrobyte2

I am using the plugin https://bitbucket.org/TheBosZ/cordova-plugin-run-in-background/src/master/ and it has the same problems. It is working fine for some hours, then it stops

ThorvaldAagaard avatar Jan 20 '20 01:01 ThorvaldAagaard

@JohannesPertl @ThorvaldAagaard it should work properly if this was used in your tests:

cordova.plugins.backgroundMode.on('activate', function() {
   cordova.plugins.backgroundMode.disableWebViewOptimizations(); 
});

noriellecruz avatar Apr 08 '20 09:04 noriellecruz