Questions tagged [android-location]

android-location refers to the location API provided by the Android framework.

References

1355 questions
7
votes
2 answers

LocationClient doesn't give callback when screen light goes off but my WakefulThread is running flawlessly as expected

To retrieve fused location in background, I have created a library which is very similar to cwac-locpoll library created by Commonsguy. Inside PollerThread , I am trying to connect, request and retrieve the locations using LocationClient. I am able…
Mehul Joisar
  • 15,348
  • 6
  • 48
  • 57
7
votes
2 answers

Does Android ProximityAlert or Geofence drain more battery when the phone is closer to a monitored location?

If I use an Android ProximityAlert with a given radius (say 100m), and my phone is regularly near (or at) that location, will the battery drain be greater than if I am rarely near that location? Is there a distance within which the battery drain…
Richard Russell
  • 1,105
  • 1
  • 10
  • 19
7
votes
6 answers

Android geofence with mock location provider

I have started developing on Android with last Location services feature : Geofences !! Is there any known problem with mock location provider ? Following example here (https://developer.android.com/training/location/geofencing.html) my intent…
ppatierno
  • 9,431
  • 1
  • 30
  • 45
7
votes
3 answers

Starting Settings Activity for result

In my application I'm checking whether the GPS is enabled on the user's device, and if not I would like to send him to the Settings to let him turn it on. Intent intent = new…
Egor
  • 39,695
  • 10
  • 113
  • 130
7
votes
4 answers

Getting Location from coordinates

I have given coordinates for latitude and longitude, and I want make a location object with those.There isn't a constructor that takes to doubles to make a location, so I tried like this: Location l = null; l.setLatitude(lat); …
NiVeR
  • 9,644
  • 4
  • 30
  • 35
6
votes
1 answer

Why is locationmanager returning old location fixes with new gettime-timestamp?

We have an app that upon user action tries to get a location fix. It listens both on GPS and network and has a time/accuracy based decision matrix to determine when to stop listening and what fix to return. We have noticed, on occasion, a very…
Mathias
  • 3,879
  • 5
  • 36
  • 48
6
votes
4 answers

Andorid Studio lass 'FlutterLocationService' is not abstract and does not implement abstract member public abstract fun onRequestPermissionsResult

Out of nowhere, the build is crashing with a strange error related to the location component , the error is in the "src..\location\FlutterLocationService.kt:" Here is the error: e:…
6
votes
2 answers

Test provider for mock location not working on Android 10

Mock location are not working on Android 10, crash when addTestProvider are called: 2020-11-30 00:25:16.855 13189-13256/br.com.tupinikimtecnologia.fakegpslocation E/AndroidRuntime: FATAL EXCEPTION: DefaultDispatcher-worker-2 Process:…
felipe.rce
  • 237
  • 2
  • 8
  • 35
6
votes
2 answers

Flutter background location access

When I went to update my app on Google Play, I saw a warning about something called "Sensitive app permissions" that I haven't seen before. It seems to concern call, SMS, location and file access permissions. Google Play Policy center /…
Magnus
  • 17,157
  • 19
  • 104
  • 189
6
votes
1 answer

Using IntentService for Location listening but onDestroy called immediately after onHandleIntent

I am using an IntentService to listen for GPS location updates so it'll run when the user leaves the activity. The IS sends the Location in a message to the activity's handler. The problem is, when the user hits the "stop tracking" button, the…
6
votes
3 answers

How to detect if user turned off Location in Settings?

I want to detect if the user turned off the location at runtime. I can check if he turns it on or if the location was turned off by user before the app was started but I can't check if he turned it off after. Code Sample: MapEntity extends…
martin1337
  • 2,384
  • 6
  • 38
  • 85
6
votes
1 answer

MyLocationOverlay dispatchTap() doesn't propagate

I have a MapView with some overlays and a subclass of MyLocationOverlay on top of them because I want the user current location to show above the other markers. I'm handling the onTap event for the markers to show a panel with info of the tapped…
maid450
  • 7,478
  • 3
  • 37
  • 32
6
votes
3 answers

android : location api asking for wifi

This is weird. I mean, I have strong network, and GPS is turned On, still it asks for Wifi !! I'm using new Location Api with class FusedLocationProviderClient. This is how I am checking if Location Settings are enabled or not: private void…
Chintan Soni
  • 24,761
  • 25
  • 106
  • 174
6
votes
1 answer

What's location provider "passive"? Seen on HTC Desire with Android 2.2

Before I go into location based mode I check for existence of any location providers by calling List android.location.LocationManager.getProviders(boolean enabledOnly) //enabledOnly = true and checking the size of the resulting list. Now I…
OneWorld
  • 17,512
  • 21
  • 86
  • 136
6
votes
1 answer

Android Location Update After Every 5min If Vehicle Not Moving

I have a situation like the following: If car is stationary(not moving) than i want to call location update api after every 5min. If car is moving than i want to call location update api after every 2min. or If car keep moving 2000 meters distance…