Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: 90% battery consumption and android warning to force app to close. #51

Closed
wemersonrv opened this issue Apr 27, 2020 · 8 comments

Comments

@wemersonrv
Copy link

wemersonrv commented Apr 27, 2020

Hello.

I'm using background_locator to store locations in background without sendint it to port listened on UI... see here: Issue 30 - comment:610746281 and the result is amazing! But the problem is the excessively high battery consumption!!!

Users are complaining that background locator is consuming about 90% of battery and that android itself is warning them to force the application to stop.

I configured background_locator in a keep alive way, even when user closes the app and just to store locations in background in Shared Preferences... and to capture locations every 5 minutes, and each 30 minutes (about 5 or 6 captures), sent these results to my server. The idea is just to store user location for statistics.

BackgroundLocator.registerLocationUpdate(
      LocationBackground.callback,
      androidNotificationCallback: LocationBackground.notificationCallback,
      settings: LocationSettings(
        notificationTitle: "My App",
        notificationMsg: "My App Title",
        notificationIcon: 'ic_background',
        wakeLockTime: 20,
        autoStop: false,
        interval: 60 * 5,
      ),
    );

Well, my question is about battery: There is a way to optimize this consumption? I thought that this would only generate some consumption when it captures, but apparently it drains more battery because the GPS is active all the time.

If i change the captures from 5 to15 minutes interval, it will reduce this behavior ? Will reduce at least 2/3 of captures processing.

@RomanJos
Copy link
Contributor

Wait interval is in second right ?

@wemersonrv
Copy link
Author

Wait interval is in second right ?

Yep... exactly!!!

5 minutes is: 60 * 5 = 300 seconds

@RomanJos
Copy link
Contributor

Oh god I feel so dumb lol I thought it was a divided 😄

Then I don't know why it take this amout of batterie, I put the interval to 5 seconds and don't have any problem 🤔

@wemersonrv
Copy link
Author

Oh god I feel so dumb lol I thought it was a divided 😄

Then I don't know why it take this amout of batterie, I put the interval to 5 seconds and don't have any problem 🤔

No problem. 😆

Well, this feedback is from our testers, the app is in closed beta test yet. So i receive it as a tester feedback.

I will ask user about OS version, etc... Any information that can help ?

@RomanJos
Copy link
Contributor

I have literally no idea, 90% seems quite impressive thought, did you tried on your devices ? You'll maybe find an explanation

@wemersonrv
Copy link
Author

I have literally no idea, 90% seems quite impressive thought, did you tried on your devices ? You'll maybe find an explanation

Yes, just completed 2.5 hours on my device, with 1% consumption. Good so far!

@mehdok
Copy link
Collaborator

mehdok commented Apr 27, 2020

In theory looking for new location should just happens in specified interval, so between this interval there shouldn't be any GPS request.
Please try lowering accuracy and let me know if anything changes.

@wemersonrv
Copy link
Author

In theory looking for new location should just happens in specified interval, so between this interval there shouldn't be any GPS request.
Please try lowering accuracy and let me know if anything changes.

Well, this happens only with one of my testers. So i think this is a damaged battery issue, not from plugin... User battery is damaged?! I don't know, but have 500 users testing my app and just one has this issue.

Because of that, I'm closing the issue. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants