Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a service for sending http request that runs on background and works fine on "normal mode". The problem is when I put my phone on "battery saver mode", the service not working. But, apps like Whatsapp still working. Do you have any idea what's going on?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
369 views
Welcome To Ask or Share your Answers For Others

1 Answer

Mobile applications like Whatsapp must be requesting permission to exempt them from Doze/battery saving and App standby mode.

It is possible to configure this manually by configuring the Whitelist in Settings > Battery > Battery Optimization.

Alternatively from API 23, you can use permissions model to request users to whitelist them (refer this). From API You can also check whether your app is currently on White list by calling isIgnoringBatteryOptimizations()

However you need to satisfy certain criteria for being able to whitelist yourself. Otherwise you face issues while maintaining app on Google Play Store.

But mostly messenger apps like Whatsapp are triggered through high-priority push notifications so they are more likely to be active despite not running background process.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...