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

background_location doesn't work in background. #106

Closed
phuhungtran opened this issue Jul 19, 2021 · 3 comments
Closed

background_location doesn't work in background. #106

phuhungtran opened this issue Jul 19, 2021 · 3 comments
Labels
duplicate This issue or pull request already exists

Comments

@phuhungtran
Copy link

phuhungtran commented Jul 19, 2021

I followed "How to use" on pub.dev and use this function.

ElevatedButton(
onPressed: () async {
await BackgroundLocation.setAndroidNotification(
title: 'Background service is running',
message: 'Background location in progress',
icon: '@mipmap/ic_launcher',
);

                      await BackgroundLocation.startLocationService();
                      BackgroundLocation.getLocationUpdates((location) {
                        _bloC.background = _bloC.backgr + 1;
                        print("-------------------------");
                        print(location.latitude.toString());
                        print(location.longitude.toString());
                        print(DateTime.now());
                        print("-------------------------");
                      });
                    },
                    child: Text('Start Location Service')),

But it doesn't work when the app pause (put the app into the background).
I use a real device Android.

@savassuphan
Copy link

cihazın izinlerini kontrol et, konum iznini arka planda konum güncellemeleri almadan önce ayarla eğer izin verilmişse uygulamayı başlat.

@phuhungtran
Copy link
Author

cihazın izinlerini kontrol et, konum iznini arka planda konum güncellemeleri almadan önce ayarla eğer izin verilmişse uygulamayı başlat.

Yes, I put permissions in AndroidManifest and the device accepted location permission.
Sometimes it works, but it just work in about 10seconds.

@alifurkanbudak
Copy link

Maybe check this answer

@MoralCode MoralCode added the duplicate This issue or pull request already exists label Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

5 participants