2

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..

Space Ghost
  • 765
  • 2
  • 13
  • 26
  • possible duplicate of [Send SMS in android](http://stackoverflow.com/questions/4967448/send-sms-in-android) – John Apr 22 '14 at 03:56

2 Answers2

5

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>
John
  • 3,769
  • 6
  • 30
  • 49
  • Thanks John. I tried everything and was lost. I used the GUI to add the permission and it resulted in my manifest I posted. I see what you did though so thanks again, this fixed the issue. – Space Ghost Apr 22 '14 at 04:02
1

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>
Engr Waseem Arain
  • 1,163
  • 1
  • 17
  • 36