Testing the class library (Should know)

This is a very simple recipe, which we use to verify that the class library works as expected.

Getting ready

If you haven't already started an emulator with our custom system image (explained earlier), do so now.

How to do it…

Build the APK. Install it via the command line (adb install). The SDK will not detect the running emulator since the SDK we use is standard/unmodified, and hence will not understand the dummy API level -20. Therefore, a launch from Eclipse will not work. However, the installation procedure is no different from a normal app installation via the command line. As specified in the Android Developer documentation, an APK may be installed by specifying the adb install command with an APK filename. The output looks like the following:

How to do it…

How it works…

The emulator is running an image of the firmware that contains the PacktCrypto service. This was started at the system boot time. The class library simply obtains a copy of the service object through the Service Manager and invokes the getMD5() method. This is abstracted away in the class library which allows development of applications independently of code that runs on an actual system.

In the preceding recipes, our modifications have been tightly integrated with the platform code. In certain cases, such levels of integration may not be needed, but new features need to be added to the system. In such cases, a developer can add code to the framework in the form of a platform library. In this recipe, we will learn how to create a platform library and learn how to write an application which uses it.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.126.241