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
– viana