3.6 Android Services: Page 3 of 3

Now let us execute our code. Open emulator and run the project. You shall see the home page of your app as shown in 

                                                       Figure ServiceEx App’s home page


Now press the start service button and you would be notified about the initiation of your service with a message. The output of this action should be similar to the snapshot shown below:

                                                               Figure Android Service is started

Now press the stop service button and you will be prompted with the message that service is destroyed.


Figure Stop the Android service


Now some of you may think whether our service was stated dynamically or it’s just a fake notification!! Don’t worry; there is a solution to this common doubt. After pressing the stop service button and getting the message, press this button again and be sure, you are not going to get any notification. This is because the service is destroyed and it is not restarted by pressing start service button. We are pressing the stop button twice. So, how come we stop something which was not started? Thus, our app is not a fraud. It is a simple and excellent example of service.

 So now we are done with the next level introduction of the service. Congratulations!! See you in the nesx sub-section with something new and exciting concepts. Till then Happy app developing!! Enjoy them and practice them as much as you can. That’s the only door for excellence.