Login     Sign Up
Cyril Sermon (@admin)
10 months ago

How to code Hello, Android in the android development Studio

Whether you’re an experienced mobile engineer, a desktop or web developer, or a complete pro-gramming novice, Android represents an exciting new opportunity to write innovative applica-tions for mobile devices.

Despite the name, Android will not help you create an unstoppable army of emotionless robot warriors on a relentless quest to cleanse the earth of the scourge of humanity. Instead, Android is an open source software stack that includes the operating system, middleware, and key applica-tions along with a set of API libraries for writing mobile applications that can shape the look, feel, and function of mobile handsets.

Small, stylish, and versatile, modern mobile phones have become powerful tools that incorpo-rate cameras, media players, GPS systems, and touch screens. As technology has evolved, mobile devices have become about more than simply making calls, but their software and development platforms have struggled to keep pace.

Until recently, mobile phones were largely closed environments built on proprietary operating systems that required proprietary development tools. The phones themselves often prioritized native applications over those written by third parties. This has introduced an artificial barrier for developers hoping to build on increasingly powerful mobile hardware.

In Android, native and third-party applications are written using the same APIs and executed on the same run time. These APIs feature hardware access, location-based services, support for back-ground services, map-based activities, relational databases, interdevice peer-to-peer messaging, and 2D and 3D graphics.

Using this instructions, you will learn how to use these APIs to create your own Android applications. In this chapter, you’ll learn some mobile development guidelines and be introduced to the features available from the Android development platform.

Android has powerful APIs, excellent documentation, a thriving developer community, and no develop-ment or distribution costs. As mobile devices continue to increase in popularity, this is an exciting oppor-tunity to create innovative mobile phone applications no matter what your development background.

A Little Background

In the days before Twitter.com and Facebook.com, when Google.com was still a twinkle in its founders’ eyes and dinosaurs roamed the earth, mobile phones were just that — portable phones small enough to fit inside a briefcase, featuring batteries that could last up to several hours; they offered the freedom to make calls without being physically connected to a landline.

Increasingly small, stylish, and powerful mobile phones are now as ubiquitous as they are indispens-able. Hardware advancements have made mobiles smaller and more efficient while including an increasing number of peripherals.

Beginning with cameras and media players, mobiles now include GPS systems, accelerometers, and touch screens. While these hardware innovations should prove fertile ground for software develop-ment, the applications available for mobile phones have generally lagged behind the hardware.

The Not So Distant Past

Historically, developers, generally coding in low-level C or C++, have needed to understand the specific hardware they were coding for, generally a single device or possibly a range of devices from a single manufacturer. As hardware technology has advanced, this closed approach has struggled to keep pace.

More recently, platforms like Symbian have been created to provide developers a wider target audience. These systems have proved more successful in encouraging mobile developers to provide rich applica-tions that better leverage the hardware available.

These platforms offer some access to the device hardware, but require writing complex C/C++ code and making heavy use of proprietary APIs that are notoriously difficult to use. This difficulty is amplified when developing applications that must work on different hardware implementations and is particu-larly true when developing for a particular hardware feature like GPS.

In recent years, the biggest advance in mobile phone development has been the introduction of Java-hosted MIDlets. MIDlets are executed on a Java virtual machine, abstracting the underlying hardware and letting developers create applications that run on the wide variety of hardware that supports the Java run time. Unfortunately, this convenience comes at the price of restricted access to the device hardware.

In mobile development, it’s considered normal for third-party applications to receive different hardware access and execution rights compared to native applications written by the phone manufacturers, with MIDlets often receiving few of either.

The introduction of Java MIDlets has expanded developers’ audiences, but the lack of low-level hard-ware access and sandboxed execution have meant that most mobile applications are desktop programs designed to run on a smaller screen rather than take advantage of the inherent mobility of the handheld platform.

The Future

Android sits alongside a new wave of mobile operating systems designed for increasingly powerful mobile hardware. Windows Mobile and Apple’s iPhone now provide a richer, simplified development environment for mobile applications. However, unlike Android, they’re built on proprietary operating systems that often prioritize native applications over those created by third parties and restrict commu-nication among applications and native phone data. Android offers new possibilities for mobile applica-tions by offering an open development environment built on an open source Linux kernel. Hardware access is available to all applications through a series of API libraries, and application interaction, while carefully controlled, is fully supported.

In Android, all applications have equal standing. Third-party and native Android applications are written using the same APIs and are executed on the same run time. Users can remove and replace any native application with a third-party developer alternative; even the dialer and home screens can be replaced.

What It Isn’t

As a disruptive addition to a mature field, it’s not hard to see why there has been some confusion about what exactly Android is. Android is not:

❑A Java ME implementation Android applications are written using the Java language, but they are not run within a Java ME virtual machine, and Java-compiled classes and executables will not run natively in Android.

❑Part of the Linux Phone Standards Forum (LiPS) or the Open Mobile Alliance (OMA) Android runs on an open source Linux kernel, but, while their goals are similar, Android’s complete software stack approach goes further than the focus of these standards-defining organizations.

Simply an application layer (like UIQ or S60) While it does include an application layer,

“Android” also describes the entire software stack encompassing the underlying operating sys-

tem, API libraries, and the applications themselves.

❑A mobile phone handset Android includes a reference design for mobile handset manufac-turers, but unlike the iPhone, there is no single “Android Phone.” Instead, Android has been designed to support many alternative hardware devices.

❑Google’s answer to the iPhone The iPhone is a fully proprietary hardware and software plat-form released by a single company (Apple.com), while Android is an open source software stack produced and supported by the Open Handset Alliance and designed to operate on any hand-set that meets the requirements. There’s been a lot of speculation regarding a Google-branded Android phone, but even should Google produce one, it will be just one company’s hardware implementation of the Android platform.