Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android local permission Androidmanifest SMS READ

Tags:

android

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>
like image 974
Venu Avatar asked Sep 20 '15 10:09

Venu


People also ask

How do I change SMS permission on Android?

In some versions of Android, this permission is turned on by default. In other versions, this permission is turned off by default. To set the app's permission on a device or emulator instance, choose Settings > Apps > SMS Messaging > Permissions, and turn on the SMS permission for the app.

What information does AndroidManifest file contain?

The manifest file describes essential information about your app to the Android build tools, the Android operating system, and Google Play.

What is read phone state permission in Android?

Reading phone state (READ_PHONE_STATE) lets the app know your phone number, current cellular network information, the status of any ongoing calls and so on. Make calls (CALL_PHONE).


1 Answers

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

like image 198
Venu Avatar answered Oct 02 '22 23:10

Venu