katzer / cordova-plugin-background-mode

Keep app running in background
Apache License 2.0
1.38k stars 1.02k forks source link

Android 7 crashing #326

Open aniciom opened 7 years ago

aniciom commented 7 years ago

I'm having a problem, i installed the last version (0.7.2) and its working fine on IOS 11 but when i compile my app in ionic1 on android 7 (sdk 26 - cordova android 6.3.0), open the app and press the main button or back button in the main page (without previous navigation) the app doesn't go to background, the app gets killed and android tells me that the app crashed, anyone got this problem too?

I have this in the .run() app.run(function($ionicPlatform,$interval,$rootScope,$state) { $ionicPlatform.ready(function() { cordova.plugins.backgroundMode.enable(); }); });

I also tried adding cordova.plugins.backgroundMode.overrideBackButton() and cordova.plugins.backgroundMode.excludeFromTaskList() and different combinations but not luck I'm missing something ?

adb.txt I attach adb logcat's log, maybe this can help

I discovered its working when i put a button and call to cordova.plugins.backgroundMode.moveToBackground() but its not working not using cordova.plugins.backgroundMode.enable()

Thanks

theoafactor commented 6 years ago

Have you been able to solve this issue?

writer0713 commented 6 years ago

@AniciusM @theoafactor I also spent long time to solve this problem. I solved this problem with below github (fork version).

try below command.

$ ionic cordova platform rm android
$ ionic cordova platform rm ios
$ ionic cordova plugin add https://github.com/tushe/cordova-plugin-background-mode.git
$ npm install --save @ionic-native/background-mode

$ ionic cordova platform add android
$ ionic cordova platform add ios
cnmoro commented 5 years ago

@writer0713 thank you so much, I've been struggling for a few hours with this issue.. your forked version is working fine

writer0713 commented 5 years ago

@cnmoro you're welcome :) have a nice day.

pc-perrycima commented 5 years ago

@writer0713 Thanks. After 1 day of research i resolve it with simply following your step.

Genarito commented 5 years ago

@writer0713 you're my hero. Thank you so much!

writer0713 commented 5 years ago

@pc-perrycima @Genarito you are welcome :) Hope you enjoy developing. Have a nice day.

ebellumat commented 5 years ago

Works on Android 9, thanks a lot!