rekabhq / background_locator

A Flutter plugin for updating location in background.
MIT License
287 stars 321 forks source link

🤖 [ANDROID] When app runing in background, it only get a minute location data by android #274

Closed quewen08 closed 2 years ago

quewen08 commented 2 years ago

I clone your example code runing in RedMi 5, here is the flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel unknown, 2.2.3, on Microsoft Windows [Version 10.0.19043.1165], locale zh-CN)
[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
[√] Chrome - develop for the web
[√] Android Studio
[√] IntelliJ IDEA Community Edition (version 2019.2)
[√] VS Code (version 1.60.0)
[√] Connected device (3 available)

• No issues found!

The Android Version is 8.1.0 The MIUI Version is MIUI 10 9.8.29

Questions:

mehdok commented 2 years ago

Hi @quewen08 Thank you for opening an issue;

First, I have to say that the Chinese Rom are famous for their strict battery monitoring, so before any investigation please disable the battering monitoring service or add your app to their exceptions;

by the way, Can you still see the notification after one minute?

quewen08 commented 2 years ago

Hi @mehdok Thank you for your reply!

I really know this ROM is very hate. So I tried to add the app to the battery whitelist, then it worked!

quewen08 commented 2 years ago

I forked your code and added a little functionality

https://github.com/quewen08/background_locator/commit/fefc19939c8648fb9de1700af5beb0896d380859

mehdok commented 2 years ago

@quewen08 Thank you for your contribution;

I have added a little comment on your code, please change that part and submit a PR;

quewen08 commented 2 years ago

@mehdok

Thank you comment, it looks nice! I changed that and submit a pr. Like you see #276