简体   繁体   中英

Android send SMS not working uid 10064 does not have android.permission.SEND_SMS?

Below is my manifest code and I already add the SMS permission in line 1. Could someone identify the problem and I could not find where the problem is?

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

<uses-permission android:name="android.permission.INTERNET" />

<uses-permission android:name="android.permission.SEND_SMS"/> // line 1

"
"
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />

<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity
        android:name=".LoginActivity"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionBar">

    </activity>
    <activity
        android:name=".SmsActivity"
        android:label="@string/title_activity_sms">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

I suspect you are compiling with android-23 API (Marshmallow) and It has introduced the new way of asking the user for permission on the spot of using it, so have two choices

  1. ( Recommended ) Ask the user for that permission before using it. More info here .
  2. ( NOT recommended ) Change you target API to a pre-Marshmallow version and that reverts to the old way of asking about all the permissions on application installation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM