guys i have problem with sms manager
about sms scheduled...in manifest i used
`<uses-permission android:name="android.permisson.SEND_SMS"/>`
but i get this error...i don't know why...i show you my LOGCAT:
FATAL EXCEPTION: main
Process: com.example.alarm, PID: 31456
java.lang.RuntimeException: Unable to start receiver com.example.alarm.AlarmReceiver: java.lang.SecurityException: Sending SMS message: uid 10051 does not have android.permission.SEND_SMS.
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2615)
at android.app.ActivityThread.access$1700(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5327)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.SecurityException: Sending SMS message: uid 10051 does not have android.permission.SEND_SMS.
at android.os.Parcel.readException(Parcel.java:1465)
at android.os.Parcel.readException(Parcel.java:1419)
at com.android.internal.telephony.ISms$Stub$Proxy.sendText(ISms.java:926)
at android.telephony.SmsManager.sendTextMessage(SmsManager.java:156)
at com.example.alarm.AlarmReceiver.onReceive(AlarmReceiver.java:24)
at android.app.ActivityThread.handleReceiver(ActivityThread.java:2597)
at android.app.ActivityThread.access$1700(ActivityThread.java:151)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1397)
at android.os.Handler.dispatchMessage(Handler.java:110)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5327)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
at dalvik.system.NativeStart.main(Native Method)
and code about receiver broadcast:
public class AlarmReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
String phoneNumberReciver="123456";
String message="blablabla";
/*String SPhone =i.getStringExtra("exPhone");
String SSms = i.getStringExtra("exSmS");*/
//android.telephony.SmsManager sms= SmsManager.getDefault();
//sms.sendTextMessage(phoneNumberReciver, null, message, null, null);
SmsManager smsManager = SmsManager.getDefault();
smsManager.sendTextMessage(phoneNumberReciver, null, message, null, null);
Toast.makeText(context, "Alarm Triggered and SMS Sent", Toast.LENGTH_LONG);
}
}
THIS IS MY MANIFEST:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.alarm"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<uses-permission android:name="com.example.alarm.permission.SET_ALARM"/>
<uses-permission android:name="android.permisson.SEND_SMS"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.example.alarm.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>
<receiver android:name=".AlarmReceiver"/>
</application>
</manifest>
WHO can help me? thanks in advance everybody!
Step 1 your menifest permission is
<uses-permission android:name="android.permisson.SEND_SMS"/>
update it with
<uses-permission android:name="android.permission.SEND_SMS"/>
its
android.permission.SEND_SMS
not android.permisson.SEND_SMS
permission spelling is wrong
step2
<receiver android:name=".AlarmReceiver">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>