Background mode not working on Android 8.0.0. Working on earlier versions
See original GitHub issueTest Environment:
- Android 8.0.0
- Phone: Galaxy S9+
- Samsung experience version 9.0
- Background Mode Version: cordova-plugin-background-mode 0.7.2 “BackgroundMode”
- Cordova Android Version: 6.4.0
- npm install output:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
- Battery optimization disabled.
Symptoms:
- Phone sleeps, fails several minutes after working in background
- Notification is not showing up for backgroundmode
- Logging the output of isEnabled(), I get an empty result (at least console.log doesn’t show anything).
I’m happy to do any debugging or additional information that might help.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:136
Top Results From Across the Web
Android 8.0 Behavior Changes
These behavior changes apply to all apps when they run on the Android 8.0 (API level 26) platform, regardless of the API level...
Read more >Fix an installed Android app that isn't working - Google Support
Try the following steps if an app installed on your phone has any of these problems: Crashing. Won't open. Won't respond. Isn't working...
Read more >Android 8.0: keeping a background service alive
That's what Google tells us. A process is not forever. If you feel you need your foreground service to stay alive permanently, ...
Read more >Android Oreo - Wikipedia
Android Oreo is the eighth major release and the 15th version of the Android mobile operating system. It was first released as an...
Read more >Dark Mode - Apps on Google Play
This app helps to activate the Android night mode on devices that do not provide this option in the system settings. This app...
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 a lot @JuneTwooo, @nadimnakade Is working great 😃 and spending much less battery and less plugins. ( with the power Management plugin was more battery consuming .)
I don’t send the local notification, I set the sticky in the default options and working !!! 😃
I set id=-1 because I am also sending some normal notifications not sticky with id>=0 and would replace this sticky one
I implemented this as an ionic provider. I’ve attempted to clean up my code for general use below, but I haven’t verified this version. My version is very similar…
` import { Injectable } from ‘@angular/core’; import { BackgroundMode } from ‘@ionic-native/background-mode’; import { Platform } from ‘ionic-angular’; import { PowerManagement } from ‘@ionic-native/power-management’;
@Injectable() export class backgroundProvider {
} `