Questions tagged [android-location]

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

References

1355 questions
5
votes
2 answers

How to check if Location Settings have failed when changed

I am creating a locationrequest object of the LocationRequest class whose methods are used to determine the level of location accuracy my app needs. private LocationRequest mLocationRequest; mLocationRequest = new…
Vinit Singh
  • 51
  • 2
  • 4
5
votes
1 answer

FusedLocationProvider - any way to get a location if location mode is "Device Only"?

I've been playing around with FusedLocationProvider and I found that if your phone's Location Mode is set to "Device Only" (changed in Settings - it means only GPS is enabled for location. Wifi networks and cell towers aren't used to improve…
Gak2
  • 2,661
  • 1
  • 16
  • 28
5
votes
1 answer

How to catch SecurityException for location permissions

I'm getting the following crash on certain devices API 6.0+: Fatal Exception: java.lang.SecurityException: Client must have ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission to perform any location operations. at…
ADev
  • 5,259
  • 2
  • 16
  • 29
5
votes
0 answers

Mock location for specific app only

I want to set mock location for specific app only. So far, what I have understood is, if I set GPS provider with some mock location then, all apps accessing location through GPS will receive mocked location. Can it be made app specific? (means only…
Vishal Maral
  • 1,279
  • 1
  • 10
  • 30
5
votes
1 answer

Android Location Services draining the Battery - Fused Location API

We have a location based application, where based on the users location we are trying to push some notifications of campaigns. But this seems to be draining the battery of the phone and at times consuming up to 30-35% of the charge. Below is the…
Harsha M V
  • 54,075
  • 125
  • 354
  • 529
5
votes
1 answer

Android Service With Google Play Services Location Causing App to Open Randomly

I have a service which should capture the user's location and current battery level and send it to my firebase backend. For some reason it seems like whenever I have this service enabled in my app, my app will randomly open without any user…
5
votes
1 answer

Do network location provider need internet to determine location?

Do Android devices need internet when using network provider for location fetching? I see few articles saying it works without internet and few saying it needs internet. I am looking more into how Android internally does location fetching (rather…
Anil VK
  • 108
  • 1
  • 9
5
votes
0 answers

Null Pointer when requesting getLastKnownLocation from Android's LocationManager

I'm having the following error on android 21 and above. I'm having the following error, and there is no restriction on manufacturer or model for the error. java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String[]…
Gabriel Falcone
  • 678
  • 5
  • 17
5
votes
0 answers

getGoogleAppid failed/uploading is not possible Android Studio

I have an app which takes the location and sends it to a server. I get the following errors which I have no idea from where they came from: 11-05 02:47:11.699 27839-27839/? E/Zygote: MountEmulatedStorage() 11-05 02:47:11.699 27839-27839/?…
Bogdan Daniel
  • 2,689
  • 11
  • 43
  • 76
5
votes
1 answer

How to make geofences accurate?

I have a problem in the accuracy of geofences because user's location is mostly determined by mobile networks which sucks completely. My app uses geofences around selected places that will perform some action when the user enters these places...I…
5
votes
3 answers

How to set Dutch Language in Text-To-Speech?

I want to set Dutch Language in my TTS object. Following is the code, @Override public void onInit(int status) { if ( status == TextToSpeech.SUCCESS ) { int result = tts.setLanguage(Locale.getDefault()); …
user2060383
  • 979
  • 1
  • 14
  • 32
5
votes
2 answers

Caused by: java.lang.SecurityException: "gps" location provider requires ACCESS_FINE_LOCATION permission

I already set permission. Why do I still get this error? Caused by: java.lang.SecurityException: "gps" location provider requires ACCESS_FINE_LOCATION permission. My manifest contents:
le an
  • 51
  • 1
  • 3
5
votes
4 answers

What is the best way to wait for a GPS location fix?

Using my Android application, when a user does a certain action, a background service is started that fetches the current GPS location and saves it in a database in addition of doing some other stuff. In that service, I use the…
qtips
  • 625
  • 6
  • 17
5
votes
1 answer

Is there any way to get Fast (5 milliseconds) location updates in Android..?

I'm using Fused Location Provider library in android. It is working perfectly fine. But I've an issue with it, it returns location updates in 5 sec minimum. I've tried every thing like setting minimum updates time to 1 millisecond, and distance to…
Arsalan
  • 513
  • 1
  • 7
  • 22
5
votes
1 answer

Programatically install `Google Play Services` in Android device

In My Device( Karbon A 21 Mobile Phone) , When Google Play Services are not installed, my location object is null and while Google Play Services installed, it returns correct location. I know that I can check if Google Play Services are installed…