1. Create a class that inherits the server rewrite Onstartcommand. Different subroutines can be executed according to the parameters passed by intent, and a broadcast will be sent after execution is completed.
Declare the server in the declaration file add <server> tags in application, do not implicitly invoke
Intent Intent = new Intent ("broadcast identification");
2. Registering the broadcast in the main Activity
(1) First create an inner class to inherit Broadcastreceiver, and then set the interface according to the content of the Inten parameters received;
(2) define an inner class variable that you just created. Create a Intenfilter Intenfilter = new Intenfilter ("broadcast identification");
(3) Registerreceiver (internal class variable, intenfilter)
Android broadcasts and services work together to modify controls on the interface