"App is running in background, doing heavy tasks!" appears randomly when silent : true
See original GitHub issueI’m having the same trouble as @M4ttscx in the issue #341. It seems to appear when the OS closes the background service to save resources. Here is a log of the app when the error occurs:
03-15 10:18:50.835 24220-24220/com.example.app D/CordovaWebViewImpl: >>> loadUrl(javascript:cordova.plugins.backgroundMode._isActive=false;cordova.plugins.backgroundMode.fireEvent('deactivate',null);cordova.plugins.backgroundMode.ondeactivate(null);)
03-15 10:18:51.302 24220-24220/com.example.app I/Timeline: Timeline: Activity_idle id: android.os.BinderProxy@146095dd time:327335369
03-15 10:19:07.747 24220-24220/com.example.app D/CordovaActivity: Paused the activity.
03-15 10:19:07.762 24220-24220/com.example.app D/CordovaWebViewImpl: >>> loadUrl(javascript:cordova.plugins.backgroundMode._isActive=true;cordova.plugins.backgroundMode.fireEvent('activate',null);cordova.plugins.backgroundMode.onactivate(null);)
03-15 10:19:08.558 24220-24220/com.example.app D/CordovaActivity: Stopped the activity.
03-15 10:20:40.902 24220-24220/com.example.app D/LenovoAppIconTheme: ExtraResources;cleanCachedIcon;clear cache..
PID change --> 03-15 10:20:44.065 26136-26136/com.example.app D/LenovoAppIconTheme: ExtraResources;cleanCachedIcon;clear cache..
03-15 10:20:44.076 26136-26136/com.example.app D/Proxy: setHttpRequestCheckHandler
03-15 10:20:44.081 26136-26136/com.example.app I/art: jiangtaottt OpenDexFilesFromOat open_oat_file.get() == nullptr /data/app/com.example.app-1/base.apk
03-15 10:20:44.091 26136-26136/com.example.app I/art: jiangtaottt OpenDexFilesFromOat oat_location == nullptr /data/app/com.example.app-1/base.apk
Error --> 03-15 10:20:44.092 26136-26136/com.example.app E/System: elements.add : /data/app/com.example.app-1/base.apk /data/app/com.example.app-1/base.apk /data/app/com.example.app-1/base.apk
03-15 10:20:54.061 26136-26136/com.example.app D/LenovoAppIconTheme: ExtraResources;cleanCachedIcon;clear cache..
As you can see, the PID changes from 24220 to 26136 in that moment. It is necessary to say that it also makes the devices very slow.
Environment Details: Cordova: 7.1.0 Plugin version: 0.7.2 Android Version: 4.4, 5.1, 6.0 and 7.1.1
PD: If you know a quick fix to this problem, I would thank you forever
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:7
Top Results From Across the Web
App is running in background. Doing heave tasks. - Bitbucket
Notification - App is running in background, doing heavy tasks! appears randomly but silent : true my configuration backgroundMode.
Read more >How To Stop Apps From Running In The Background in Android
The easiest way to permanently stop an app running in the background is to uninstall it. On the main app page, tap and...
Read more >Background Tasks | Apple Developer Forums
Request the system to launch your app in the background to run tasks using Background Tasks.
Read more >OnePlus5 goes automatically to silent mode randomly
My one plus 5 goes to silent mode by itself even when the alert slider is all the way down.It's actually happening right...
Read more >Crashes | Android Developers
An Android app crashes whenever there's an unexpected exit caused by an unhandled exception or signal. An app that is written using Java...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
thanks @LaRadioFM I put, cordova.plugins.backgroundMode.setDefaults({ hidden: true, silent: true }); and it worked.
I had the same problem. Couldn’t understand how it happens, because it happens absolutely randomly. Even running in silent mode has no effect - no notifitation, but that nasty “heavy tasks” appears any way. So I did the following:
Run in silent mode (setting title, text and resume as a precaution)
cordova.plugins.backgroundMode.setDefaults({ title: 'Your custom title', text: 'Your custom text', resume: true, hidden: true, silent: true }); cordova.plugins.backgroundMode.enable();
Redefine defaults again with some events (user taps or something else) while app running
cordova.plugins.backgroundMode.setDefaults({ silent: true });
After implementing step 2 I have app running for about 2 days (and counting) with no notifications. I understand that it is not a good solution, but it works. For me it is more important.