I am developing an android application that receives SMS messages and uses this data inside the application. Because I want the SMS messages' BroadCastreceiver to close when I close the application, I have placed it inside the main activity:
public class App extends Activity {
public class SmsReceiver extends BroadcastReceiver {
...
}
...
}
It is added in the manifest:
<receiver android:name=".App.SmsReceiver" >
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
The activity runs fine, until I receive an SMS message. I then get the following error:
10-23 15:01:50.019: E/AndroidRuntime(10161): java.lang.RuntimeException: Unable to instantiate receiver be.allys.msgwall.app.App.SmsReceiver: java.lang.ClassNotFoundException: be.allys.msgwall.app.App.SmsReceiver in loader dalvik.system.PathClassLoader[/data/app/be.allys.msgwall.app-1.apk]
Is this because the receiver class is inside another class? That would seem like a possible cause to me, if it weren't for the fact that another post on StackOverflow advised me to do it this way.
If that's not the reason, then what is? Any help would be greatly appreciated.