Questions tagged [android-location]

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

References

1355 questions
-1
votes
1 answer

Calculate time between onLocationChanged method

I need to calculate time difference between every location change(onLocationChanged). What is a proper way to do that? My code for getting user's location: public class LocationService extends Service implements …
-1
votes
1 answer

Get Location updates from GPS only, not from Network

I need accurate location updates. When using FusedLocationServices from GooglePlayServices, even if I set HighAccuracy, it will get locations from Wi-Fi and cellular when GPS is not available. How do I request locations ONLY from GPS, and with no…
f.khantsis
  • 3,256
  • 5
  • 50
  • 67
-1
votes
1 answer

Lack of GPS accuracy resulting in null pointer

ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATON have both been included in the manifest. Also included in the Activity are: import android.location.Location; import android.location.LocationManager; I have a listener for the nav drawer with the…
-1
votes
1 answer

Unable to get location co-ordinates and display them on screen

My requirement is very simple. I want to get the user's location and display the same on screen. The emulator shows Currently reported location correctly. But I am unable to extract the same to my TextView. Not quite sure what is wrong here. Please…
Varun Joshi
  • 599
  • 2
  • 9
  • 24
-1
votes
1 answer

Why getLastLocation() method not retrieving the location the very first time app is launched?

I'm developing an android app and I want to retrieve user's current location as soon as the app is launched. I'm using this code: @Override public void onConnected(@Nullable Bundle bundle) { if (ActivityCompat.checkSelfPermission(this,…
-1
votes
3 answers

How do I find out programmatically which mode of Location is turned on?

I am developing an application in which the user's location is tracked using the GPS provider only (device only mode of Location) . Therefore if the user sets his location priority to Approximate Location using Wifi and Data, the application wont…
Sourav Kanta
  • 2,727
  • 1
  • 18
  • 29
-1
votes
2 answers

Google Places Android Autocomplete: can I remove the country from the place name?

I am using Google's Place Api for getting a list of places from the string searched from a end user. But i want to remove the country name from the suggestion coming as well as from list of responses for a address. how can i achieve this in android…
Punit Sharma
  • 2,951
  • 1
  • 20
  • 35
-1
votes
1 answer

How to return value on GoogleApiClient onConnected()?

I am using GoogleApiClient to get user location. I created a singleton class to get user location. Here is that class: public class LocationUtils { private static LocationUtils locationUtils; private GoogleApiClient googleApiClient; …
-1
votes
2 answers

Android request permission Fused Location API return TODO cannot resolve

return TODO; I am trying to detect userlocation using fused location API,it asks me to check permission from user but it gives "Cannot resolve symbol TODO" private Location getLocation() { // If Google Play Services is available if…
-1
votes
1 answer

I need more accurate positon in my location now its like 24.0 and i want 24.1235152

I want it to be more accurate in calculations. Now is like a 24.0, but I want it to be 24.1234512563. I don't know what I need to change. I was trying to change from int to double but it is not working. import android.app.Activity; import…
-1
votes
1 answer

How to give option for enable GPS

I want to show dialog box for turn on GPS when GPS is disable . See the image. When i click on YES then should be automatically turn on my GPS without going into setting. So , how can i enable GPS by select YES option ?
user3997016
-1
votes
1 answer

How to continuously fetch location of user in android?

I want to fetch the current location (latitude,longitude pair) of user and send it to server only when user has traveled 100 Kilo meters away from previous fetched location. What is the best way to do this if there is any? My purpose is to use…
Tushar Kathuria
  • 645
  • 2
  • 8
  • 22
-1
votes
2 answers

How to get notified the status of location and Bluetooth on or off in side my fragment

In my application it is require the status of Bluetooth and location, so that the functionality always depends on those status . is there any way to get the enable or disable status of both Bluetooth and location at same time?. any way i got the…
-1
votes
2 answers

Unable to get location using LocationRequest or getLastLocation()

I've been working on this for quite some time. I've tried everything I can think of. I'm trying to get a rough location (Coarse location). First try was the following: googleApiClient = new GoogleApiClient.Builder(this) …
Asim
  • 6,962
  • 8
  • 38
  • 61
-1
votes
1 answer

Displaying current location on a map

The code that i wrote is supposed to show the location of the device on a map when the user opens the app.So i tried it on my phone and when i opened it i could see my location, however i walked about 2 km from that location and then opened the app…