Problems with permission ACCESS_COARSE_LOCATION android studio

Asked

Viewed 632 times

2

I’m building a project that uses the class Gsmcelllocation. I can know such information from the class Telephonymanager.

For this, I need permissions where the problem is born. An ACCESS_COARSE_LOCATION permission

When arriving at the line below, I get return from Exception, Securityexception.

TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
GsmCellLocation cellLocation = (GsmCellLocation) telephonyManager.getCellLocation();

Caused by: java.lang.Securityexception: getCellLocation: Neither user 10609 nor Current process has android.permission.ACCESS_COARSE_LOCATION.

No problems in the order of my permissions in the manifest.

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />


<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionBar" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

Someone’s been through this... I have no idea what I’m missing.. =T

  • I have already published an answer on this question of permission, take a look: http://answall.com/a/148189/35406

1 answer

-1

ACCESS_COARSE_LOCATION permission is not available for applications that are not part of the firmware 'which in this case is yours' because the security settings are designed to be protected against modifications by third party applications.

  • Where did you read it?

  • I’d like to know the source, too. This does not make sense to me, since the permission of the question serves to obtain the location by wifi or triangulation of antennas . What that would change in the device?

  • Alessandro.. Can you send your source on the subject? I’m also interested in reading..

Browser other questions tagged

You are not signed in. Login or sign up in order to post.