transistorsoft / react-native-background-geolocation

Sophisticated, battery-conscious background-geolocation with motion-detection
http://shop.transistorsoft.com/pages/react-native-background-geolocation
MIT License
2.64k stars 425 forks source link

App is consuming power in the background #611

Closed francelaquino closed 5 years ago

francelaquino commented 5 years ago

Your Environment

Expected Behavior

The app should run continuously in foreground or background

Actual Behavior

The mobile is stopping the app even though there is enough battery. It also show a message app is frequently positioning

Context

I also download the sample application from play store and let it run, its show a message BG Geolocation is consuming power in the background, then after a while the app stops working.

So far all this happens using Huawei

christocracy commented 5 years ago

Chinese device manufacturers, such as Huawei are horrible when it comes to foreground-services. Their flavour of Android is far too aggressive killing foreground-services. Yes, the plugin's foreground-service is subscribed to the MotionActivity API (which consumes little power) in order to determine when the device is moving so it can know when to run on location-services and begin tracking (and importantly so it can know when the device is no longer moving, so it can turn off location-services).

Try this:

The music should continue playing.

francelaquino commented 5 years ago

Yes, the music still playing. May I know your point? (sorry)

Is my config needs adjustment to fix the issue?

christocracy commented 5 years ago

Yes, the music still playing. May I know your point? (sorry)

Because the plugin runs a foreground-service just as a music player does. Some Chinese devices actually stop playing music when the player app is terminated, OnePlus, I think.

Keep your music player playing and see if the OS eventually terminates it.

Quite often, the solution to prevent the plugin's tracking service stopping is the same for people searching for "Why is my music player stopping?"

francelaquino commented 5 years ago

Our app is working fine, except huawei, do you have idea or workaround that we can do to solve the issue.

christocracy commented 5 years ago

I have a Huawei P20 arriving today.

christocracy commented 5 years ago

See this comment