You have probably not declared your class SMSReceiver in your manifest file.
On Mon, Apr 1, 2013 at 11:35 PM, TWProgrammers <[email protected]>wrote: > I am trying to create an app that receives SMS messages and if it has a > specific prefix it uses the information in it then deletes it. I have it > where it shows no errors and seems like it would run but when ran it force > closes. Here is my code: > > SMSReceiver.java: > > package com.TWP.Project.IES; > > import android.content.BroadcastReceiver; > import android.content.Context; > import android.content.Intent; > import android.os.Bundle; > import android.telephony.SmsMessage; > import android.widget.Toast; > import com.TWP.Project.IES.DenCryption; > > public class SMSReceiver extends BroadcastReceiver > { > DenCryption decrypter = new DenCryption(); > @Override > public void onReceive(Context context, Intent intent) > { > Bundle bundle = intent.getExtras(); > Object messages[] = (Object[]) bundle.get("pdus"); > SmsMessage smsMessage[] = new SmsMessage[messages.length]; > for (int n = 0; n < messages.length; n++) > { > smsMessage[n] = SmsMessage.createFromPdu((byte[]) messages[n]); > } > if(smsMessage[0].getMessageBody().startsWith("*DenCryption3*:")) > { > String msg = > smsMessage[0].getMessageBody().replace("*DenCryption3*:", ""); > msg = decrypter.decrypt(msg); > Toast toast = Toast.makeText(context, msg, Toast.LENGTH_LONG); > toast.show(); > abortBroadcast(); > } > } > } > > > AndroidManifest.xml: > > <manifest xmlns:android="http://schemas.android.com/apk/res/android" > package="com.TWP.Project.IES" > android:versionCode="1" > android:versionName="1.0" > > > <uses-sdk > android:minSdkVersion="8" > android:targetSdkVersion="8" /> > <uses-permission android:name="android.permission.RECEIVE_SMS"/> > <uses-permission android:name="android.permission.WRITE_SMS"/> > > <application > android:allowBackup="true" > android:icon="@drawable/ic_launcher" > android:label="@string/app_name" > android:theme="@style/AppTheme" > > <receiver android:name="com.TWP.Project.TDC.SMSReceiver" > android:enabled="true"> > <intent-filter android:priority="2147483647"> > <action > android:name="android.provider.Telephony.SMS_RECEIVED" /> > </intent-filter> > </receiver> > </application> > > </manifest> > > > I am attaching the log from LogCat. I can't seem to find what my problem > is. > > -- > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Android Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Warm Regards, Ankita Kashyap -- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

