nativescript-geolocation icon indicating copy to clipboard operation
nativescript-geolocation copied to clipboard

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

Open dimitriospafos opened this issue 4 years ago • 1 comments

Which platform(s) does your issue occur on?

  • Android

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

dimitriospafos avatar Jan 29 '21 03:01 dimitriospafos

Any update here?

Amira-tageldin avatar Apr 22 '21 10:04 Amira-tageldin