Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android location permissions

In my Android application I'm willing to use GPS locations.

  1. What are the main permissions that I should included in android manifest file in order to use GPS locations.
  2. In case of lost the GPS signal strength, is there any way to triangulate the position using mobile networks.

Thank you!

like image 575
Samantha Withanage Avatar asked Jan 26 '14 01:01

Samantha Withanage


People also ask

What permissions are required for location in Android?

Android offers two location permissions: ACCESS_COARSE_LOCATION and ACCESS_FINE_LOCATION .

How do I enable location access on Android?

Open your phone's Settings app. Under "Personal," tap Location access. At the top of the screen, turn Access to my location on or off.

What does location permission off mean?

The 'Location permissions off' status means they've disabled the phone's GPS, or they have denied the GPS permissions for Life360.


2 Answers

The main permissions you need are android.permission.ACCESS_COARSE_LOCATION or android.permission.ACCESS_FINE_LOCATION.

Only fine location will allow you access to gps data, and allows you access to everything else coarse location gives. You can use the methods of the LocationManager to acquire location data from gps and cell tower sources already, you do not have to work out this information yourself.

If you are targeting API Level 21 (5.0) or higher, you may also need this:

<uses-feature android:name="android.hardware.location.gps" /> 
like image 155
Jems Avatar answered Sep 18 '22 15:09

Jems


This permission should allow your app to use location services through the devices GPS, wifi, and cell towers. Just plop it in your manifest wherever you put your permissions, and it should do the trick. You can find all the other permissions here: (http://developer.android.com/reference/android/Manifest.permission.html)

Here is the code:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> 
like image 44
The Creator Avatar answered Sep 18 '22 15:09

The Creator