337 questions
0
votes
1
answer
94
views
ForegroundServiceDidNotStartInTimeException when using startForegroundService() with FusedLocation API
I have one issue in foreground service and I am unable to replicate that issue, so if any one found similar issue can you please help me to solve this issue.
Below is the issue reported in Firebase ...
0
votes
1
answer
47
views
How to display "To continue" instead of "For a better experience" when requesting location activation?
|-|i
To make my app able to let the user enable location, I use exception.startResolutionForResult
But my app displays "For a better experience, your device will need..."
Although I see ...
1
vote
0
answers
93
views
Clean Architecture and Fused Location Provider
I am trying to integrate com.google.android.gms.location library into my project which is heavily focused on Clean Architecure.
I understand how things come together in the data layer and how I can ...
1
vote
0
answers
92
views
GPS updates (satellites) in background - FusedLocationProvider vs LocationManager, Device Power Saving vs App's Battery Unrestricted, Android version
So depending on which API we use (FusedLocationProvider or LocationManager), battery mode (Device Power Saving or Battery Unrestricted for an app), Android version, the app may not receive GPS updates ...
0
votes
3
answers
4k
views
Get current location in Android Development
I have a service worker that runs every 10 minutes and needs to get the current latitude and longitude every time it runs and I've been using the following code:
private var fusedLocationClient: ...
1
vote
2
answers
69
views
Discrepancy between Google Maps Timeline and getLastLocation() in Android app
I've developed an Android application that calls the getLastLocation() function to record coordinates every minute.
However, I've observed a discrepancy between the coordinates logged by Android ...
1
vote
2
answers
1k
views
On a Jetpack Compose application, is there a way to use LocationServices.getFusedLocationProviderClient to query a location value once
I am trying to understand how to use Location services in an Android App developed using Jetpack Compose. Following some tutorials I came across; I have written the following code component to ...
0
votes
1
answer
71
views
How to implement fusedprovider on request location updates
How can I implement on request location updates so that instead of getting the users last location I can constantly get their current location.
Code is: https://pastebin.com/8vLb0NF6
this is what I ...
1
vote
1
answer
93
views
How can I set sensitivity for my gps tracker?
Could you please help me? I have a task to make a GPS tracker that would pass GPS data to Firebase. But the key point is that the tracker should have the following sensitivity - 60 meters (10 for test ...
0
votes
0
answers
381
views
Android Background and Foreground location services
Great People out there! I am writing the code for the location tracking I have written both foreground service and a coroutine worker for the background location update. But the problem is when I use ...
0
votes
2
answers
76
views
android fusedlocationclient not getting location
My android project needs the users last / current location upon launching but I am not getting a valid location for some reason.
My Main activity checks for the permissions like this:
override fun ...
0
votes
1
answer
53
views
How to improve the accuracy of position detected using FusedLocationProviderClient?
I'm working on an app that is used by salespersons visiting stores on a few different cities. While visiting the stores, every salesperson have to log his/her coordinates.
Here's my code:
public class ...
1
vote
0
answers
18
views
How to get my service launching in background only when the phone is in standby and fire the onLocationResult fusedlocation when the people is moving?
I have my fusedlocationprovider that works perfectly, for the distance and for the time when the person is not moving.
function with my FusedLocationProvider:
private void startLocationUpdates() {
...
1
vote
0
answers
126
views
FusedLocationProviderClient doesn't work with PRIORITY_BALANCED_POWER_ACCURACY (no satellites), only with PRIORITY_HIGH_ACCURACY
Previously in my app I have been using PRIORITY_HIGH_ACCURACY for FusedLocationProviderClient:
private fun getLocationRequest(): LocationRequest =
LocationRequest.Builder(prefsManager....
0
votes
1
answer
60
views
How to get the onLocationResult be triggered all the 30m of displacement in a LocationRequest with the locationCallback?
I don't understand, the Interval in milliseconds works well, but the minimum distance doesn't work. How to get the onLocationResult be triggered all the 30m of displacement in a LocationRequest with ...
0
votes
0
answers
285
views
Fused Location Provider method getLastLocation() returning null values
I am implementing a location android app , using fused location provider client .It has been working few days ago but actually it craches because it is returning as value null and here is what i got ...
4
votes
1
answer
1k
views
RequestLocationUpdates() with no location updates on Foreground for Android 12 +
I'm currently working on a location feature to track device location using FusedLocationProviderClient. When App is visible the tracking is working as intented on all Android versions. But when ...
0
votes
1
answer
614
views
Problem: Attempt to invoke virtual method 'android.content.pm.ApplicationInfo android.content.Context.getApplicationInfo()' on a null object reference
Process crashed while executing mainTest(ru.myitschool.lab23.InstrumentedTestGeo):
java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.pm.ApplicationInfo android.content....
0
votes
0
answers
229
views
FusedLocationProviderClient: Position frequency
I'm trying to get a good position via android and GNSS.
The locationManager of Android in every case returns only one update per second. So I decided to switch to the GoogleFusedApi and the ...
0
votes
0
answers
94
views
How to avoid wrong locations in android while getting locations through FusedLocation?
I am getting device' locations through fused location service, then sending these location to backend to draw line on map. It is working fine.
As we know, fused location is a free service and it has ...
2
votes
3
answers
1k
views
Create LocationRequest for API lower than 31
I have compileSdkVersion 32 and now I can create LocationRequest only using LocationRequest.Builder. LocationRequest.create() currently unavailable, means I can't even call this deprecated static ...
1
vote
1
answer
918
views
Cannot stop Fused Location Provider using removeLocationUpdates()
I have an activity that is receiving the user location every X seconds. When the user location is within the radius of 15 meters from a specific point, I want the Location Provider to stop updating ...
4
votes
1
answer
724
views
Recording GPS location in the background doesn't work when battery optimizations are enabled on Android
We develop an application which is used for outdoor activities (hiking, bicycle, mountain bike, ...) and one of the main features of the application is to record the track of the user thanks to the ...
2
votes
0
answers
162
views
Fused Location Provider does not responding
I have tested my app in Moto G3(Android 6), Vivo y19(Android 12), Poco M2 pro(Android 11), oppo A15(Android 10), Nokia 2.1(Android 8) everything works fine. But when it comes to POCO X3(Android 12, ...
5
votes
0
answers
327
views
Why am I getting these Android logcat error messages while accessing device location?
I am using the Fused Location Provider API to both get current location and to request regular location updates. As far as I can tell, my permissions are configured correctly (both fine and coarse are ...
2
votes
3
answers
9k
views
Get user's current location in Jetpack Compose Android
Intention:
I am trying to get user's current location after user grants (coarse/fine)location permission. I am using jetpack compose accompanist lib to manager permission.
So when user grants the ...
0
votes
0
answers
397
views
Android Fused Location provider accuracy in tunnels
I'm building an app where I need very good accuracy. The app is calculating trip in the car for the companies I work with.
I came to the point where it counts just like a odometer in a car, but my ...
1
vote
0
answers
215
views
Some time Android Fused location client return wrong location (I am in India but it returns location for US Colorado)
Below is the code used for getting the location
private fun requestLocation() {
Utils.print("LocationUpdateService","request location per minute")
if (...
0
votes
1
answer
626
views
Location request takes a lot time to run after refresh
I am working currently on weather app from a tutorial. The app works fine until the moment when I try to refresh everything and request once again a location and call API using the new location. ...
2
votes
0
answers
16k
views
How to detect fake location in Android? [duplicate]
I am working on an app in which I have to trace the location of drivers. I used fusedlocation and GPS location methods for this purpose. It is working fine.
But some drivers/users have installed Fake ...
1
vote
0
answers
637
views
Background Service to Loop FusedLocation
I cannot seem to create an infinite loop that runs periodically for a background service and is reliable.
The app uses a Service to post a GPS location every 5 seconds using a FusedLocationClient ...
1
vote
0
answers
82
views
Use FusedLocationProvider When Device is Asleep
I am using Fused Location Provider Client and Location Request on an android app to send the phone's location every 5 seconds. However, I stop getting location updates when the device is asleep. I ...
2
votes
0
answers
915
views
Independent/standalone GPS App on Samsung Galaxy Watch 4 still requires phone connection
I need my Wear OS sailing App to provide GPS updates when no phone is connected. Unfortunately despite specifying the App as standalone the GPS updates stop as soon as the Bluetooth link to the phone ...
7
votes
2
answers
1k
views
FusedLocationProviderClient always reports LocationAvailability false
I have an app which has been live for a couple of years now, but lately, I've been getting reports about the location system not functioning properly.
I have tracked the issue down to the ...
1
vote
1
answer
1k
views
Unresolved reference: LocationRequest for Android S (12)
Android 12 SDK seems to be stable now
if
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
minSdkVersion 23
targetSdkVersion 30
then Play Services Location works fine
...
1
vote
0
answers
375
views
What are the request limits on background location in Android 11+ in a foreground service (FLP)?
Our Android app starts a foreground service that is guaranteed to be foregrounded by the user before use. However, we now need to get user location even when the user has backgrounded the app or ...
0
votes
0
answers
169
views
Fused location provider does not always return the location according to the criteria
I have this code for request location updates:
private var fusedLocationClient = LocationServices.getFusedLocationProviderClient(context)
locationRequest = LocationRequest.create().apply {
...
2
votes
2
answers
7k
views
FusedLocationProviderClient not working correctly when Location turned on/off
I am using location to implement geofencing functionality (limiting app usage to one country) In first activity in application I am using FusedLocationProviderClient to get location like this:
Init ...
1
vote
0
answers
79
views
Android location update using fused returns null. How to ensure I get it from foreground activity?
I need the location once in my foreground activity. But I get a null response.
Weirdly once I open google maps the location callback returns a valid object. What is google maps doing that I'm not? How ...
1
vote
1
answer
992
views
Android FusedLocationClient with PendingIntent not receiving location update when app is in background
I'm using FusedLocationClient and broadcast receiver to get location in background, i enabled background location background permission and locations (FINE and COARSE) permission. i receive location ...
0
votes
2
answers
652
views
How to fix memory leak issue in FusedLocationApi Fragment?
I am using fused location api to find the current location in the fragment, sometimes getting a memory leak
How to fix this issue?
com.android.zigmaster.ui.home.FragmentSearch instance
...
0
votes
0
answers
557
views
Get Location Updates When App is Closed Android
I am making an app that allows users to search for nearby users of my app, so I need to update users' location periodically, and this process should be triggered even when the app is closed.
I have ...
0
votes
1
answer
135
views
GPS doesn't work or updates are very slow when device is connected to FM transmitter via USB port in the car
An user of my app reports the next
I found out that when I put my phone on charger (via fm transmitter
USB port) then the problem exist. If I run the phone from battery,
then the GPS in the app works ...
0
votes
1
answer
143
views
Android battery consumption in case of frequent call of fusedLocationProviderClient lastKnownLocation?
I have this use-case of sending the user's location when I hit a certain API. As this API call is frequent, I want to avoid the battery consumption of the app.
I am okay with using the ...
0
votes
1
answer
1k
views
Foreground service is being killed by Android after some time
For location updated I have used Fused Location API, but it seems that some Android phones are killing the foreground service after a while. How I can run foreground services and be sure that they won'...
8
votes
2
answers
5k
views
Android: App is rejected by Google because of background location
I have issues with my app recently, when it is out of nowhere rejected by Google Play because they found that I'm using background location. But in fact I'm not using this feature. I have only ...
2
votes
1
answer
1k
views
What is recommended interval for location updates to get real-time vehicle speed?
Right now I have such settings for location updates:
private const val LOCATION_MIN_TIME_INTERVAL = 200L
private val locationRequest = LocationRequest().apply {
interval = ...
0
votes
1
answer
137
views
How to subscribe to providers status change events using Fused Location?
Google recommends using FusedLocationProviderClient instead of LocationManager
Using LocationManager I could subscribe to change status events of providers by using LocationListener interface:
void ...
1
vote
1
answer
2k
views
FusedLocationProviderClient.getCurrentLocation(): Background apps calling this method will be throttled under background location limits
In the docs for FusedLocationProviderClient.getCurrentLocation() it says as follows:
This method may return locations that are a few seconds old, but never returns much older locations. This is ...
1
vote
1
answer
887
views
Location Update from Work Manager Doesn't work
Recently I've been trying to implement the logic in order to get Location Updates from a FusedLocationProviderClient using Work Manager, every 15 mins (as that's the minimum background execution delay)...