I have a
Either you can do 2 things:
For option 2 (which you are asking):
BroadcastReceiver in code (MyBroadcastReceiver).
Declare MyBroadcastReceiver in the scope of your
BroadcastReceiver in your
IntentFilter filter = new IntentFilter(android.provider.Telephony.SMS_RECEIVED); this.registerReceiver(mMyBroadcastReceiver, filter);