I’m wondering is it possible to activate BroadcastRecievers onRecieve method for recieving SMS to be active only for a limited time after pressing a button?
I dont want it to be active all the time, and to conflict with my messenging app.
I a made class “public class SmsReciever extends BroadcastReceiver” and defined reciever in manifest:
<receiver android:name="SmsReciever" >
<intent-filter >
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
If you want to activate BroadcastReceiver temporarily, you should not define receiver in the manifest. You should register receiver in the code:
and unregister receiver when it is not needed more: