Venu
Venu

Reputation: 101

android local permission Androidmanifest SMS READ

Configuration:

I am learning Android and started working on SMS read a simple project.

I have added the permissions in the SMS_READ in the AndroidManifest.xml. Still when run emulator it throwing error permission denial for SMS_READ.

I am not sure that emulator problem or API 23 level permission change?

Error:

Caused by: java.lang.SecurityException: Permission Denial: reading com.android.providers.telephony.SmsProvider uri content://sms/inbox from pid=1900, uid=10058 requires android.permission.READ_SMS, or grantUriPermission()
            at android.os.Parcel.readException(Parcel.java:1599)
            at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:183)
            at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:135)
            at android.content.ContentProviderProxy.query(ContentProviderNative.java:421)
            at android.content.ContentResolver.query(ContentResolver.java:491)
            at android.content.ContentResolver.query(ContentResolver.java:434)
            at com.example.gunda.mysmsreadapp.MainActivity.fetchInbox(MainActivity.java:68)
            at com.example.gunda.mysmsreadapp.MainActivity.onCreate(MainActivity.java:36)
            at android.app.Activity.performCreate(Activity.java:6237)
            at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
            at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
            at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
            at android.app.ActivityThread.-wrap11(ActivityThread.java)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:148)
            at android.app.ActivityThread.main(ActivityThread.java:5417)
            at java.lang.reflect.Method.invoke(Native Method)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Here is the manifest xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.gunda.mysmsreadapp" >
    <uses-permission android:name="android.permission.READ_SMS"/>
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        android:exported="true"

        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <!--<action android:name="android.provider.Telephony.READ_SMS" />-->
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

Upvotes: 7

Views: 5664

Answers (3)

Diptendu Das
Diptendu Das

Reputation: 4610

Just update here -if you want to use READ_SMS permission then you request Google with declaration why your app needs this permission, then they give access to your app. read this support.google.com/googleplay/android-developer/answer/9214102

Upvotes: 0

Venu
Venu

Reputation: 101

at last i found the answer: API 23 (android 6.o) required different type of permission.....

http://inthecheesefactory.com/blog/things-you-need-to-know-about-android-m-permission-developer-edition/en

Upvotes: 3

Hassan Naqvi
Hassan Naqvi

Reputation: 423

Permission name is READ_SMS it seems you are using SMS_READ.

Upvotes: 0

Related Questions