HaylLtd / cordova-background-geolocation-plugin

Background and foreground geolocation plugin for Cordova.
Apache License 2.0
57 stars 66 forks source link

Plugin not working in android 12 after a long time in background or device locked #90

Closed ivinantony closed 1 year ago

ivinantony commented 2 years ago

Describe the bug This plugin not working in android 12 after a long time in background .

To Reproduce Steps to reproduce the behavior: Install the plugin and run in an android 12 device. But if we give background permission it works but i crashes in some devices while gives the permission Expected behavior It should work both in foreground and background .

Additional context Add a detailed description for the permissions which need to be given to work this plugin in android 12 and also android 9 doesn't have allow all the time permission too.so it is little bit confusing

HarelM commented 2 years ago

Please provide the plugin logs for this case.

josuelmm commented 2 years ago

Check that the battery saver is set to "no restrictions"

ivinantony commented 2 years ago

@josuelmm let me try this

ivinantony commented 2 years ago

@josuelmm can you just provide me an example of the code you have done? And also the same for the permission too. This background issue is seems in Samsung note and some android 8 devices having some permission issues. So the documentation is little bit confusing or dont have enough data about the permissions and other stuffs

ivinantony commented 2 years ago

Should we ask OS specific permissions ??? Does it need background permission to work for a long time in android. But Everything works fine in ios

ivinantony commented 2 years ago

@HarelM does this app need background location permission to working on the android 12 devices??? And the app getting crashed if we don't ask physical activity permission first.

HarelM commented 2 years ago

No need for background permission if you want the user to know that the app is running in the background. Use startForground to make the plugin run for long time. This plugging doesn't support well running in the background without letting the user know - which is what this permission is all about. Please read other issues in this repo and android tutorials to better understand this subject.

ivinantony commented 2 years ago

I have done this but it terminated the android after a long time

ivinantony commented 2 years ago

I removed custom permissions and when the plugin ask for the default permission popup and when we click on it the app is getting stuck. Its mainly happening in Samsung devices. How can i fix this issue??

HarelM commented 2 years ago

You'll need to debug this on your own. Sorry. I have around 50k users and haven't got any support ticket that sounds like this issue...

ivinantony commented 2 years ago

For me too its facing for some users with Samsung device.let me check with a Samsung device.for working this plugin in background we don't want to give background permission right??

HarelM commented 2 years ago

Please try version 2.0.6. There might have been a problem with FLAG_IMMUTABLE that was fixed there...

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 1 year ago

This issue has been automatically closed, because it has not had recent activity. If you believe this issue shouldn't be closed, please reopen or write down a comment requesting issue reopening with explanation why you think it's important. Thank you for your contributions.