Im creating an app in which i do a task when i receive a call (detect RINGING state with a BROADCASTRECEIVER ).My question is that,can I register and unregister (literally;ON and OFF) his broadcastreceiver from an activity having 2 buttons;say one for ON and another for OFF?
Does it require the BROADCASTRECEIVER to be declared inside the activity?If I do so,can i register and unregister it,via the activity?
this is the way i would do it: