Posts

Showing posts from April, 2018

Android Binder Tutorial [Part Six]: Obtaining and using Java service.

Image
Introduction. We previously introduced the process of registering Java Service. In this tutorial we look at how the application obtains and makes calls to the Java Service interface. AIDL. In the Java Services, the AIDL tool is often used. The explanation of AIDL in the google official document is: "  AIDL (Android Interface Definition Language)" is similar to other IDLs you might have worked with.   It allows you to define the programming interface that both .The client and service agree upon in order to communicate with each other using interprocess communication (IPC) . That is, AIDL is an interface description language used to define interfaces that are mutually agreed upon by client and service. It sounds more circumstantial and directly looks at the general contents of IWifiManger.aidl .   This defines a series of function interfaces. An AIDL, in addition to Java primitive data (int, long, char, boolean, etc.), it also supports String, CharSeq

Android Binder Tutorial [Part Five]: Registering a Java Service.

Image
Introduction. In this tutorial we will walk through WifiService to analyze how to register a Service in the Java framework. We will stick to the WiFiService [System Service] as it will give us all the required insights on android services. Ofcourse any application can add a service and it behaves roughly same as a system service with some exceptions which is beyond the scope of this tutorial and will be covered sometime later. Before analyzing the registration of WifiService let us first look at the WifiService related classes . Android WIFI  We know that  SystemServer.java  starts all the java services used by the system and hence the first pit stop in our journey. The servicemanager gets the classname to start and calls startService() for that class. Remember the following statemements in systemServiceManager.java 1.Constructor<T> constructor = serviceClass.getConstructor(Context.class);             service = cons