Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Neither user nor current process has android.permission.ACCESS_COARSE_LOCATION

I know it may be silly question and I have referred all the similar question before but unfortunately I could resolve this issue. Most probably it is problem in my Manifest.xml file.

When I am trying to access location, app is crashing

here is my manifest.xml

<?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.test.tt.test" >

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

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


    </activity>
    <service android:name="com.test.tt.test.sService">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter> </service>
    <service android:name="com.test.tt.test.sServiceRequest" />

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


</application>

when I run it throw this error

 java.lang.SecurityException: Neither user 11029 nor current process has android.permission.ACCESS_COARSE_LOCATION.

Similar with other permissions. I can not see any mistake in my manifest file. Help appreciated

like image 398
user3290805 Avatar asked Oct 11 '14 08:10

user3290805


2 Answers

If you are running on a device on Android Marshmallow and above:

If the device is running Android 6.0 or higher and if the app's target SDK is 23 or higher, the app not just have to list the permissions in the manifest but also must request each dangerous permission it needs while the app is running.

More info:

http://developer.android.com/training/permissions/requesting.html

and

http://developer.android.com/guide/topics/security/permissions.html#normal-dangerous

like image 80
sivag1 Avatar answered Oct 22 '22 23:10

sivag1


This means you have some wrong information or malformed info in your menifest file and that is the reason none of your Permission is not identified by your app. Just make sure you have cleaned ANDROIDMANIFEST file with any malformed data.

It will work and all permission should be outside Application tag

like image 12
JNI_OnLoad Avatar answered Oct 23 '22 00:10

JNI_OnLoad