0

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>

KKKK
  • 347
  • 7
  • 18
  • 3
    Possible duplicate of [Can't Get the Permission](http://stackoverflow.com/questions/32635704/cant-get-the-permission) – Mike M. Mar 22 '16 at 19:44

1 Answers1

1

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.
Ahmed Hegazy
  • 12,395
  • 5
  • 41
  • 64
  • Hi, my code now can runs but my phone cannot get the message.http://stackoverflow.com/questions/36164118/android-sms-not-working – KKKK Mar 22 '16 at 20:13