Android an open handset alliance project



Download 74.74 Kb.
Date30.06.2017
Size74.74 Kb.
#22030




ANDROID

- AN OPEN HANDSET ALLIANCE PROJECT

What is Android? 

Android brings Internet-style innovation and openness to mobile phones. 

Android™ delivers a complete set of software for mobile devices: an operating system, middleware and key mobile applications. The Android Software Development Kit (SDK) is now available. 


Open 

Android was built from the ground-up to enable developers to create compelling mobile applications that take full advantage of all a handset has to offer. It was built to be truly open. For example, an application can call upon any of the phone's core functionality such as making calls, sending text messages, or using the camera, allowing developers to create richer and more cohesive experiences for users. Android is built on the open Linux Kernel. Furthermore, it utilizes a custom virtual machine that was designed to optimize memory and hardware resources in a mobile environment. Android is open source; it can be liberally extended to incorporate new cutting edge technologies as they emerge. The platform will continue to evolve as the developer community works together to build innovative mobile applications. 

All applications are created equal 

Android does not differentiate between the phone's core applications and third-party applications. They can all be built to have equal access to a phone's capabilities providing users with a broad spectrum of applications and services. With devices built on the Android Platform, users are able to fully tailor the phone to their interests. They can swap out the phone's homescreen, the style of the dialer, or any of the applications. They can even instruct their phones to use their favorite photo viewing application to handle the viewing of all photos. 


Breaking down application boundaries 

Android breaks down the barriers to building new and innovative applications. For example, a developer can combine information from the web with data on an individual's mobile phone -- such as the user's contacts, calendar, or geographic location -- to provide a more relevant user experience. With Android, a developer can build an application that enables users to view the location of their friends and be alerted when they are in the vicinity giving them a chance to connect. 

Fast & easy application development 

Android provides access to a wide range of useful libraries and tools that can be used to build rich applications. For example, Android enables developers to obtain the location of the device, and allows devices to communicate with one another enabling rich peer-to-peer social applications. In addition, Android includes a full set of tools that have been built from the ground up alongside the platform providing developers with high productivity and deep insight into their applications. 


Google has invited the media to attend "an Android press gathering," at its Mountain View, California campus on 5 January 2010, according to AFP. The invitation comes amidst reports that the Internet search giant would release a Google-branded smartphone known as Nexus One on 5 January 2010. "With the launch of the first Android-powered device just over a year ago, we've seen how a powerful, open platform can spur mobile product innovation," the invitation said. "And this is just the beginning of what's possible." The event will take place the same week as the 2010 Consumer Electronics Show (CES) in Las Vegas.

Android is an application framework on top of Linux. It is supplied as open source code, but does not bind the user with the constraints of the GPL " there is no requirement for developers to make public any code developed using Android. 

Android Architecture 

An Android system consists essentially of five software layers: 


1) Linux 
2) Libraries 
3) Runtime 
4) Application Framework 
5) Applications 

The Android Framework



















Description

Internet-based services are expected soon to be accessed more often through mobile devices, such as smart phones, than through more traditional devices, such as desktop and laptop PCs. The popularity of the iPhone and the Windows Mobile devices already provide sufficient support for this point of view. Further support is provided by statistics around desktop, laptop and mobile computing users. These statistics report that worldwide, by 2007, there were on the order of 1.5 Billion PC-based internet users, compared to around 3.25 Billion mobile phone users.

Google spent the last few years paving the way for its own entry in this segment. Interestingly, they did it through an alliance of software developers, handset manufacturers and telecommunication service providers. This is the Open Handset Alliance, which lists as its members companies like Texas Instruments, Intel, T-Mobile, and Sprint Nextel.

Furthermore, for the software stack of this initiative, the Android framework, they chose the open source route. Specifically, the kernel of the operating system, at the base of Android, is a variant of Linux, its application development language is Java, and its eminent adopted development environment is Eclipse.

For corporate IT leaders and planners, this all boils down to a new platform where existing and new corporate applications may need to have touch points. This seminar is meant to brief these leaders and planners on what the Android framework is, its components, and its main features. It also gives them a glimpse into what these new application touch points would look like, and what is involved in developing them.






Objectives

Upon completion of this course, attendees will be able to:

  • Understand what Android is, beyond the hype

  • Identify Android's main components

  • Understand Android's features

  • Have a high level grasp of the anatomy of an Android application

  • Have a high level grasp of Android applications' development environment and processes

  • Understand Android's timeline and status




Course Outline

What is Android

  • Application framework for mobile devices

  • Integrated browser

  • Optimized graphics

  • GSM Telephony

  • Bluetooth, EDGE, 3G, and WiFi

  • Camera, GPS, compass, etc.

  • Rich development environment

The Android Software Stack Layers

  • Linux Kernel

  • Libraries

  • Android Runtime

  • Application Framework

  • Applications

Android Application Building Blocks

  • Activity

  • IntentReceiver

  • Service

  • ContentProvider

Resources Manipulated

  • Storage

  • Libraries

  • Network

  • Multimedia

  • GPS

  • Phone Services




Android SDK

  • API

  • Emulator

  • Android Development Tools Eclipse Plugin

Android Developer Challenge

  • Motivate developers to produce engaging applications

  • Developer Challenge I and II each have a $5MM USD purse

  • Developer Challenge II will begin after devices go on sale

Time Line and Status

  • 5 Nov 2007: Android announced

  • 12 Nov 2007: "Early Look" SDK released

  • 3 Jan 2008 - Android Developer Challenge I Starts

  • 12 May 2008: Top 50 Application in Challenge I announced

  • 28 Aug 2008: Android Market introduced

  • 23 Sep 2008: G1 Announced by T-Mobile, HTC and Google

  • 23 Sep 2008: Android 1.0 SDK Release 1 available

  • 22 Oct 2008: Android 1.0 devices available at retail

  • Q4 2008: Source code released

  • Q4 2008: Key Announcement on Android Developer Challenge II




The Android platform itself

The Android platform is a Linux 2.6 kernel, a custom-made Java Virtual Machine called Dalvik, and a set of Java classes specially tailored for mobile use. The Google pages devoted to Android have lots of technical details. One important thing to understand is that all Android applications are in Java, and they all run as separate Linux processes. The Android system assigns each process a unique Linux user ID; this is the basis of the Android security model.



The SDK

You need to download the Android SDK as the first step.

Google recommends using the SDK as an Eclipse plugin. We found little value in doing that. We are mainly a NetBeans shop. We found that the easiest way to get started is simply to use the command-line tools.

And the tool to use is activityCreator.py, which creates an Activity. An Activity corresponds roughly to a "screen". You're building an application, which normally consists of a few Activitys. Applications can have other components, such as Services, but we'll start withActivitys.

activityCreator --out /home/me/MyApplication \

chiralsoftware.androidapp.MainActivity

This creates an activity called MainActivity in the chiralsoftware.androidapp package, in the /home/me/MyApplication directory. It also creates a helpful build.xml file.

The package is complete and ready to run. Let's try it out before making any changes.

Start the emulator. No arguments are needed:

emulator


You have two ways of deploying the application to the emulator. The easiest is to use the build.xml script, but we'll show you the command-line way first.

Build the app:

% ant

Buildfile: build.xml


dirs:

[mkdir] Created dir: /tmp/droid/bin/classes


resource-src:

[echo] Generating R.java...


aidl:
compile:

[javac] Compiling 2 source files to /tmp/droid/bin/classes


dex:
package-res:
package-res-no-assets:

[echo] Packaging resources...


package-dex:

[echo] Packaging dex...


package:
BUILD SUCCESSFUL

Total time: 3 seconds

This creates a file called bin/MainActivity.apk. Normal Java applications are shipped as Java Archive (JAR) files, which are essential ZIP files containing Java class files. Android applications instead use a .apk file, which is also a ZIP archive, but with a different format from a JAR file. In particular, a APK file does not have a META-INF or a MANIFEST.MF. It does have an AndroidManifest.xml file. It looks like this:

jar tf bin/MainActivity.apk

res/layout/main.xml

AndroidManifest.xml

resources.arsc

classes.dex

Where are the classes? They are in the classes.dex file. This is a special binary file format which wraps a set of ordinary Java classes.

AndroidManifest.xml seems like it would be a simple copy of the AndroidManifest.xml that's in the application source directory. It isn't. It's some binary format, which presumably contains the same information in a format which is quicker for Android to process.

With the emulator running, use the adb tool to copy the MainActivity.apk file over into the emulator's virtual memory:

adb install bin/MainActivity.apk

45 KB/s (4130 bytes in 0.088s)

adb can connect to the emulator because the emulator listens on certain TCP ports which adb knows.

Click "all" on the emulator and the activity shows up:



google android

Click on the app to run it, and you'll see the Hello World message.

The easier way to do all this is to run the emulator, and then use the build.xml script:

ant clean install

That does it all.

Getting work done

The main functionality you'll use is the Activity.

You can lay out the display using code, but this is not recommended. Instead, it is best to create the layout in a separate layout XML file. This layout file creates UI components with IDs. In this case, the layout file is in res/layout/main.xml. We can put assign the objects IDs in the layout file like this:


android:id="@+id/password"

android:layout_width="164px"

android:layout_height="wrap_content"

android:padding="10px"

android:textSize="18sp"

android:password="true"

>

Then, the build.xml file's resource-src task uses the aapt program to generate a file called R.java. R contains references to all the objects with IDs in the layout file, so in R we have:

public final class R {
public static final class id {

public static final int password=0x7f04000a;

Now, within the activity, we can get the password field and read text from it as follows:

final EditText passwordField = (EditText) findViewById(R.id.password);

String password = passwordField.getText().toString();

It's different from how we think of Swing or web layouts. It's also better. Layout should not be in code. Swing and other systems are moving in this same direction.



Visual design: using DroidDraw

Hand-coding the necessary layout files is a pain. The best way to do it is to use a visual design tool. That tool is DroidDraw, Android's answer to NetBeans' Matisse. Download and run the DroidDraw JAR, and try some layout.



google android

Remember to go to the Properties tab of the layout components to give them an ID which you can refer to using the R class.

Save the file directly into the res/layout directory.

Debugging

Do make use of the logging class, like this:

import android.util.Log;
Log.i("LogTag", "This is a log message", exception);

When the Log.i method is called, a log message is generated. You can view logs easily with the adb logcat command:



adb logcat

I/DEBUG ( 494): debuggerd: Feb 28 2008 17:13:08

D/AndroidRuntime( 496):

D/AndroidRuntime( 496): AndroidRuntime START

I/AndroidRuntime( 496): Assertions enabled for ALL code (-ea and -esa)

I/runtime ( 497): Startup: sys='/system' asset='/system/app' data='/data'

I/runtime ( 497): Entered boot_init()!

D/runtime ( 497): ProcessState: 0x124e8

I/runtime ( 497): Binder driver opened. Multiprocess enabled.

D/AndroidRuntime( 496): --- registering native functions ---

Log messages will show up in this stream.

Conclusion

Developing with Android is a pleasure. We're confident that Android will be a major platform in the near future, and we're looking forward to continuing to develop for it.

Future articles will discuss how to use Activitys, including adding them to the AndroidManifest.xml file, and calling one Activity from another. We'll also discuss our favorite topic, which is client-server. With the right class libraries, it's not difficult to use SOAP for client-server interactions. We'll demonstrate Android using SOAP to communicate with JBoss Seam web services.

If your business needs to kick start its Android development to have products ready when the first Android handsets hit the stores for this year's gift season, contact us at 310 356 7869, or at sales@chiralsoftware.net, and we can discuss getting your Android project started.





Download 74.74 Kb.

Share with your friends:




The database is protected by copyright ©ininet.org 2024
send message

    Main page