NativeScript / nativescript-geolocation

Geolocation plugin to use for getting current location, monitor movement, etc
Apache License 2.0
139 stars 77 forks source link

Android foregroundService location requests while screen is off for a while not working #275

Open dimitriospafos opened 3 years ago

dimitriospafos commented 3 years ago

Which platform(s) does your issue occur on?

I have a foreground service running on android which get's the user's geolocation upon connecting to a bluetooth device. I'm using the "getCurrentLocation" which is provided by the geolocation plugin.

Everything works fine except one case: App is open -> Works as expected App is closed but screen is on -> Works as expected App is killed but screen is on -> Works as expected App is killed but screen is off for some time -> The Foreground service is unable to get the location

Based on my findings it seems like there are two methods that the Android API provides: https://developers.google.com/android/reference/com/google/android/gms/location/FusedLocationProviderClient.html#requestLocationUpdates(com.google.android.gms.location.LocationRequest,%20android.app.PendingIntent)

Screen Shot 2021-01-28 at 10 40 01 PM

In the geolocation plugin the "requestLocationUpdates" is using the first method without the "PendingIntent". Is there plan to add the functionality that uses the second method of the Android API which uses the "PendingIntent"?

Screen Shot 2021-01-28 at 10 36 32 PM
Amira-tageldin commented 3 years ago

Any update here?