Android Started Service Example

This post describes how to start a Service and stop a Service on Button click. Create your layout in activity_main.xml. Add a TextView for displaying date, a Button for starting service, and another button for stopping Service. Create a java file, MyService.java and add following code. In AndroidManifest.xml add the Service class. In MainActivity.java bind … Read more