Question

I'm just trying to send a simple text to my self.. of course the exception is java.lang.SecurityException: Sending SMS message: uid 10263 does not have android.permission.SEND_SMS

This is what my Manifest file looks like

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.homesafe"
    android:versionCode="1"
    android:versionName="1.0" 
    android:permission="android.permission.SEND_SMS">

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="19"
         />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"

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

             >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>

Right now it is under the Manifest tag.. but even if I move the permission under the application tag, I still get the same error. I'm confused..

Was it helpful?

Solution

All you need to do is this:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.homesafe"
    android:versionCode="1"
    android:versionName="1.0">

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

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="19"
         />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme"

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

             >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>

OTHER TIPS

Add Your permissions after use-sdk like that:

 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.homesafe"
    android:versionCode="1"
    android:versionName="1.0">

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="19"/>

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

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">

        <activity
            android:name="com.example.homesafe.MainActivity"
            android:label="@string/app_name"

             >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top