Service in Android part2

In my last tutorial, we learned the basics of service used in the android application.We have understood that what are the basic difference between the Service and Intent Service. We also learned basic of bound Service. If you have not checked the detail then do not wait, Please check this link Service in Android part1.Now we got one more day to learn something new about the Service that used on the application side. In this article, we will learn about service which using the technique of Messenger and AIDL. Wow Sounds great :).Bound Service (Messenger and AIDL) In this article, I am focusing on the bound services which are running in the background in the different process in the single thread and multi-tread environment. If we talk about the Single thread for sending the message in a queue the first thing comes in mind is that Messenger.Messenger Messenger will process the message in a different process by using IPC (Inter Process Communication) remote technique to communicate with client and server. Messenger will be coupled with the handler, hence all the task will be in queue process in a Single thread by Handler.For bind the service what you need to do with pass the Messenger instance reference in onBind() method and pass the reference of handler while creating the Messenger instance. Here message will be carried in the format of the bundle with Messenger that it awesome. Let's see for example to create one service which runs in the different process by using Messenger which is the coupled by Handler.

Here also required the Service Connection to build the connection between the client and the server. The handler will process the response of Messenger and update the user interface. But one more thing does not forget to add this service in AndroidManifest.xml.