34
SRI KRISHNA ARTS AND SCIENCE COLLEGE DEPARTMENT OF BCA & M.Sc SS ANDROID PROGRAMMING (12SSI56) UNIT-I PPT- 6-7 Types of Android Applications - Developing for Mobile and embedded Devices: Developing for Android- Android Development Tools

Developing for Android-Types of Android Application

Embed Size (px)

Citation preview

SRI KRISHNA ARTS AND SCIENCE COLLEGE

DEPARTMENT OF BCA & M.Sc SSANDROID PROGRAMMING (12SSI56)

UNIT-IPPT- 6-7

Types of Android Applications - Developing for Mobile and embedded Devices: Developing for

Android- Android Development Tools

Topics to be Discussed

• Types of Android Applications – Foreground Applications – Background Applications – Intermittent Applications – Widgets and Live Wallpapers

• Developing for Mobile and Embedded Devices– Developing for Android

• Android Development Tools

Types of Android Applications

• Foreground:– application that’s useful only when it’s in

the foreground and is effectively– suspended when it’s not visible

• Background– application with limited interaction– spends most of its lifetime hidden

Types of Android Applications

• Intermittent Applications:–well-designed applications– applications that expect limited

interactivity but do most of their work in the background.

• Widgets and Live Wallpapers– applications are represented only as a home-

screen Widget or as a Live Wallpaper.

Foreground Applications• Need to consider carefully the Activity lifecycle so that

the Activity switches seamlessly between the background and the foreground.

• little control over their lifecycles and a background application with no running Services is a prime candidate for cleanup by Android’s resource management.

• Need to save the state of the application when it leaves the foreground, and then present the same state when it returns to the front.

• present a slick and intuitive user experience

Background Applications• run silently in the background with little user

input.• listen for messages or actions caused by the

hardware, system, or other applications, rather than relying on user interaction.

• can create completely invisible services, but in practice it’s better to provide at least a basic level of user control

• let users confi rm that the service is running

Intermittent Applications

• application that can accept user input and that also reacts to events when it’s not the active foreground Activity.

• applications are generally a union of visible Activities and invisible background Services and Broadcast Receivers.

• application needs to be aware of its state when interacting with the user

Widgets and Live Wallpapers• application may consist entirely of a Widget or

Live Wallpaper.• provide interactive visual components that can

add functionality to user’s home screens.• Widget-only applications are commonly used to

display dynamic information, such as battery levels,weather forecasts, or the date and time.

DEVELOPING FOR MOBILE AND EMBEDDED DEVICES

• Developing for Android– Android has some particular considerations.

• The Android design philosophy demands that applications be designed for:– Performance– Responsiveness– Freshness– Security– Seamlessness– Accessibility

Developing for Android• Being Fast and Efficient

Downloading and Installing the Android SDK

Downloading and Installing the Android SDK

• The screen that appears shows each of the packages available for the download.

• This includes a node for the platform tools, each of the platform releases, and a collection of extras, such as the Android Support Package and billing/licensing packages.

• You can expand each platform release node to see a list of the packages included within it, including the tools, documentation, and sample code packages.

• To get started, simply check the boxes corresponding to the newest framework SDK and the latest version of the tools, compatibility/support library, documentation, and sample code.

Downloading and Installing the Android SDK

• For testing the backward compatibility of your applications, it can often be useful to download the Framework SDK

• To use the Google APIs (which contain the Maps APIs), you also need to select the Google APIs by Google package from the platform releases you want to support.

• When you click the Install Packages button, the packages you’ve chosen will be downloaded to your SDK installation folder.

• The result is a collection of framework API libraries, documentation, and several sample applications.

Downloading and Installing the Android SDK

• For testing the backward compatibility of your applications, it can often be useful to download the Framework SDK

• To use the Google APIs (which contain the Maps APIs), you also need to select the Google APIs by Google package from the platform releases you want to support.

• When you click the Install Packages button, the packages you’ve chosen will be downloaded to your SDK installation folder.

• The result is a collection of framework API libraries, documentation, and several sample applications.

Downloading and Installing Updates to the SDK

• you can use the Android SDK Manager to download and install updates.

• All future packages and upgrades will be placed in the same SDK location.

Developing with Eclipse• using Eclipse with the ADT plug-in for

your Android development offers some significant advantages, primarily through the tight integration of many of the Android build and debug tools into your IDE.

• Eclipse –popular open source IDE for Java development.

Developing with Eclipse• Eclipse 3.5 or Above required to use the ADT Plugin.

– Eclipse 3.7 (Indigo) (Eclipse Classic download)– Eclipse Java Development Tools (JDT) plug-in– Web Standard Tools (WST)– The JDT plug-in and WST are included in most Eclipse IDE

packages.• Installing Eclipse consists of uncompressing the

download into a new folder, and then running the eclipse executable.

• Create New Workspace

ANDROID DEVELOPMENT TOOLS

• ADT plug-in conveniently incorporates many of these tools into the Eclipse IDE, where you can access them from the DDMS perspective, including the following:

ANDROID DEVELOPMENT TOOLS

• The Android Virtual Device and SDK Managers:– Used to create and manage AVDs and to download SDK

packages.– The AVD hosts an Emulator running a particular build of

Android, letting you specify the supported SDK version, screen resolution, amount of SD card storage available, and available hardware capabilities

• The Android Emulator – An implementation of the Android VM designed to run within

an AVD on your development computer. – Use the Emulator to test and debug your Android applications.

ANDROID DEVELOPMENT TOOLS

• Dalvik Debug Monitoring Service (DDMS) —– Use the DDMS to monitor and control the

Emulators on which you’re debugging your applications.

• Android Debug Bridge (ADB) — – A client-server application that provides a link

to virtual and physical devices. It lets you copy files, install compiled application packages (.apk), and run shell commands.

ANDROID DEVELOPMENT TOOLS

• Logcat – A utility used to view and filter the output of the

Android logging system.• Android Asset Packaging Tool (AAPT) – Constructs the distributable Android package

files (.apk).

ANDROID DEVELOPMENT TOOLS

• Additional tools are also available• SQLite3 — A database tool that you can use to

access the SQLite database fi les created and used by Android.

• Traceview and dmtracedump — Graphical analysis tools for viewing the trace logs from your Android application.

• Hprof-conv — A tool that converts HPROF profiling output files into a standard format to view in your preferred profiling tool.

ANDROID DEVELOPMENT TOOLS

• MkSDCard — Creates an SD card disk image that can be used by the Emulator to simulate an external storage card.

• Dx — Converts Java .class bytecode into Android .dex bytecode.

• Hierarchy Viewer — Provides both a visual representation of a layout’s View hierarchy to debug and optimize your UI, and a magnified display to get your layouts pixel-perfect

ANDROID DEVELOPMENT TOOLS

• Lint — A tool that analyzes your application and its resources to suggest improvements and optimizations.

• Draw9patch: A handy utility to simplify the creation of NinePatch graphics using a WYSIWYG editor.

• Monkey and Monkey Runner: Monkey runs within the VM, generating pseudo-random user and system events. Monkey Runner provides an API for writing programs to control the VM from outside your application.

• ProGuard — A tool to shrink and obfuscate your code by replacing class, variable, and method names with semantically meaningless alternatives. This is useful to make your code more diffi cult to reverse engineer.

New Android Project

New Android Project• The final page allows you to specify the

application properties. The Application Name is the friendly name for your application; the Package Name specifies its Java package;

• The Create Activity option lets you specify the name of a class that will be your initial Activity; and setting the Minimum SDK lets you specify the minimum version of the SDK.

New Android Project

New Android Project• Create Activity, the ADT plug-in will create a new

project that includes a class that extends Activity.

• The default template implements Hello World.

• Before modifying the project, take this opportunity to configure launch configurations for running and debugging.

Creating an Android Virtual Device

• AVD used to simulate the hardware and software configurations of different Android devices you need to create at least one before you can run and debug your applications.

• 1. Select Window-> AVD Manager (or select the AVD Manager icon on the Eclipse toolbar).

• 2. Select the New... button.• The resulting Create new Android Virtual Device

(AVD) dialog allows you to configure a name, a target build of Android, an SD card capacity, and device skin.

• 3. Create a new AVD called “My_AVD” that targets Android 4.0.3, includes a 16MB SD Card,and uses the Galaxy Nexus skin

• 4. Click Create AVD and your new AVD will be created and ready to use.

Creating Launch Configurations

• Launch configurations let you specify runtime options for running and debugging applications.

• Using a launch configuration you can specify the following: The Project and Activity to launch The deployment target (virtual or physical device) The Emulator’s launch parameters Input/output settings (including console defaults)

Creating Launch Configurations

Creating Launch Configurations

• Select Run Configurations… or Debug Configurations… from the Run menu.

• 2. Select your application from beneath the Android Application node on the project type list,

• or right-click the Android Application node and select New.

• 3. Enter a name for the configuration. You can create multiple configurations for each project,

• so create a descriptive title that will help you identify this particular setup.

Creating Launch Configurations

• 4. Choose your start-up options. The first (Android) tab lets you select the project to run and

• the Activity that you want to start when you run (or debug) the application. Figure 2-9

• shows the settings for the project you created earlier.

Creating Launch Configurations

• 5. Use the Target tab, as shown in Figure 2-10, to select the default virtual device to launch on,

• or select Manual to select a physical or virtual device each time you run the application. You

• can also confi gure the Emulator’s network connection settings and optionally wipe the user

• data and disable the boot animation when launching a virtual device.