android local permission Androidmanifest SMS READ

Configuration:

  • Studio 1.3
  • API 23
  • 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>
    

    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


    权限名称是READ_SMS,看起来你正在使用SMS_READ。

    链接地址: http://www.djcxy.com/p/29252.html

    上一篇: 在基本表达式解析器中删除左递归

    下一篇: Android本地权限Androidmanifest SMS READ