How do I exactly stops a Service in Broadcast receiver? I am using a SMS Received broadcast receiver.
I am using
context.stopService(new Intent(this, CallService.class));
where “CallService” is my service, yet I am receiving
The constructor Intent(SMSReceiver, Class<CallService>) is undefined
and the Quick Fix is to remove the arguments to match 'Intent()'
Am I doing something wrong here?
To stop the broadcast receiver, all I have to do is
context.unregisterReceiver(SMSReceiver.this);
That’s all? Do I have to do onDestroy or anything?
Thanks.
Use
contextinstead ofthisto instantiate Intent like belowThe unregister part is correct.