Questions tagged [android-gps]

Android's GPS device and related API features.

Android provides a Location and Sensors API for programmatical access to its GPS device.

733 questions
91
votes
8 answers

Get current location of user in Android without using GPS or internet

Is it possible to get the current location of user without using GPS or the internet? I mean with the help of mobile network provider.
Prabhu M
  • 3,534
  • 8
  • 48
  • 87
41
votes
6 answers

When do I need android.hardware.location.gps and android.hardware.location.network?

Google is informing by email of changes to the Android location permissions: We’re making a change on October 15th, 2016 that will affect apps targeting API version 21 (Android 5.0, Lollipop) or higher that use ACCESS_FINE_LOCATION but don't…
mattm
  • 5,851
  • 11
  • 47
  • 77
22
votes
3 answers

Android O API 26. Newly added Location methods don't work as needed

I'm using Android O Developer preview 4 - API 26 Device - Google Pixel XL And seems like the new features such as: hasSpeedAccuracy() always returns false getSpeedAccuracyMetersPerSecond() always returns 0.0 getBearingAccuracyDegrees() always…
InsFi
  • 1,298
  • 3
  • 14
  • 29
20
votes
6 answers

How can I get a user's country location?

Due to GDPR, I am requiring to check the user's location - whether the user is from the European Union. Till now I have found these solutions - Get Country using the Phone's language configuration (can misguide if the user uses English US version…
Rajesh K
  • 683
  • 2
  • 9
  • 35
16
votes
7 answers

Getting W/Activity: Can request only one set of permissions at a time

I made an app that have a request for camera and GPS, but when I execute I am getting this warning several times with less than 1 second of each other. W/Activity: Can reqeust only one set of permissions at a time) Can some one tell me…
15
votes
1 answer

Android: Can I enable the GPS without redirecting the user to the settings screen like in "google maps" app

In GPS based applications, it is important that the user enable his GPS. If not then usually we would show a dialog stating that the user "should enable his GPS from the settings to be able to use this functionality". When the user press OK he will…
A.Alqadomi
  • 1,529
  • 3
  • 25
  • 33
14
votes
5 answers

How to ask user to enable GPS at the launch of application?

private void turnGPSOn(){ String provider = Settings.Secure.getString(getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED); if(!provider.contains("gps")){ //if gps is disabled final Intent poke = new Intent(); …
Mishu
  • 269
  • 1
  • 3
  • 15
11
votes
1 answer

What is com.google.android.gms.version?

I am working in a old project which has this snippet to use in google play service: I couldn't find any official documentation…
Josema
  • 445
  • 2
  • 6
  • 22
11
votes
6 answers

How does some apps(wechat) ignore fake location and then detect the real one?

I have installed a fake location app and set my location different. Then opened Google Maps and Wechat app, Google Maps shows my location as what i set(fake) Wechat app ignores fake location and detects real location (how?) Then i wanted to…
blackkara
  • 4,900
  • 4
  • 28
  • 58
10
votes
2 answers

SettingsClient's request for location is always getting RESULT_CANCELED

In getting current location flow, I am using SettingsClient to check if location settings are satisfied based on current LocationRequest. Currently, my priority is set to HIGH_ACCURACY, which needs GPS to be enabled at all costs. …
Talha
  • 903
  • 8
  • 31
10
votes
2 answers

Getting RESOLUTION_REQUIRED always even if user press the 'OK" button in the case of checking location settings

My LocationRequest is set to PRIORITY_HIGH_ACCURACY. But in xiaomi redmi note 5 device if i press the ok button in the location settings dialog it always returns 0 through onActivityResult() method and i get…
Shadman Sakib
  • 219
  • 2
  • 10
10
votes
3 answers

Getting location updates when in doze mode

I'm trying to get location updates in my android app when in doze mode, this used to work up to android 5.x. With android 6 and the advent of doze, no matter what I do, the updates stop at some point. After reading a few articles and stackoverflow…
10
votes
2 answers

Android How to Convert Latitude Longitude into Degree format

I want to convert latitude 40.7127837, longitude -74.0059413 and to the following format N 40°42'46.0218" W 74°0'21.3876" What is the best way to do that? I tried methods like location.FORMAT_DEGREES, location.FORMAT_MINUTES and…
Julia
  • 1,207
  • 4
  • 29
  • 47
10
votes
1 answer

How to show the Google Location Services permission request dialog above / through the lockscreen?

I'm trying to show the Google Location Services (turn on GPS, network data, etc.) Dialog through lock screen. I'm using KeyguardManager to disable Lock screen. This works fine as my MainActivity is able to disable the lock screen. However, as soon…
9
votes
2 answers

Accessing NMEA on Android API level < 24 when compiled for target API level 29?

I just tried updating the target and compile API level of our app to 29 (Android 10) and noticed that I cannot compile any more because LocationManager.addNmeaListener only accepts OnNmeaMessageListener (introduced with API level 24) instead of the…
1
2 3
48 49