I am trying to start up a BroadcastReceiver within a Service. What I am trying to do is have a background running service going that collects incoming text messages, and logs incoming phone calls. I figured the best way to go about this is to have a service running that incorporates a broadcast receiver that can catalog either.
How do i go about doing this? I already have my service up and running.
as your service is already setup, simply add a broadcast receiver in your service:
in your service’s
onCreatedo this:and in your service’s
onDestroy:and you are good to go to receive broadcast for what ever filters you mention in
onCreate. Make sure to add any permission if required. for e.g.