jeudi 26 août 2010

Android in 3 days

Android OS for mobile phones is gaining market shares in an exponential rhythm : 1.8% in the second quarter of 2009 to 17.2% one year later, thus making it the third worldwide popular mobile OS just behind Symbian and RIM  (Source: Gartner).Android changed the landscape of the mobile ecosystem: HTC doubled his shares by taking the risk of massively investing on android, a platform leveraged by the APIs of Google almighty, app store, open source, active developpers community..
Personally, i was seduced by the OS and im using android on HTC legend. Im quite happy with the richness of its interface and its functionalities.But i think Google still have alot to do on its performance, clearly android have inherited the sins of Java.
So now all telcos are investing on android, and there is more and more demand on development of applications on this platform. In this context i had to discover the platform, and it took me three days to understand it and develop my first application on it. this is Mainly due to:
1 - Google provides freely a very easy to install environment: Android SDK (Emulators, platforms..) and an Eclipse plugin (ADT) that gives you all the necessary tools to develop, debug, test, deploy...
2 - Google provides tons of documentations, and plenty of well explained samples.
3 - Android is based on Java, and it is somehow inspired of some J2ME concepts. (comparison)

In the following i will explain rapidly main concepts of android, and than use them to explain my application.
An android application is composed of one or many of the following elements:


View
UI elements that form the basic building blocks of a user interface: e.g. Buttons, Images…
Activity
A user interface concept, It represents a single screen. The design of the Activity is separated of the programming logic in an XML file.
Intent
Intention to do some work: Broadcast a message, Start a service, Launch an activity, Display a web page, Dial a phone number
Content Provider
A standard mechanism for applications to share data
Service
Background processes that can be local services or remote services
Broadcast receivers
A component that receive and react to broadcast announcements: time zone has changed, that the battery is low, that a picture has been taken…
AndroidManifest.xml
Lists app’s activities and services along with application permissions

For deeper understanding of the fundamentals of android click here.
My application is a fake call simulator. it is a widget, that once it is clicked, it launches a Calling similar screen after 7 seconds and play the default ringtone of the phone. the user accepts the fake call, so an In Call screen shows up. Very useful to find an excuse to runaway from someone :)
Here are the screens of the application:


So in the AndroidManifest.xml i declared the followinf entities:
1 - FCWidget.Java: defines the behavior and design of the widget
2 - FCService.Java: the service that waits 7s and launches the fake call
3 - CallingActivity.Java: defines the first screen of the application
4 - InCallActivity.Java: defines the second screen of the application

When the widget is clicked, it start the service. After 7 seconds, the service creates and intent to launch the Calling Activity screen. Once created, the activity plays the default ringing ringtone. Clicking on the answer image button will stop the ringtone and create an intent to launch the InCall Activity. finally the End Call image button will end up the application. you can download and try the application here: Fake_Call.apk

Bref, i think android is a promising platform, many telcos are adopting it in their offers, especially that they can customize it, and a key benefit of developping products on this plateform, is the fast time to market (TTM) (i developped on iPhone, i know what im saying :D)

Achraf

1 commentaire :

  1. interesting... I had a quick look at Android, but I thought Symbian should get the upper hand being better for performance.
    It's obviously much harder to use C++, you get much less quality apps.
    Hopefully talented developers keep interest in Symbian, and Nokia improve the OS.

    RépondreSupprimer