Docsity

Android Application - Wireless Networks - Lecture Slides, Slides of Wireless Networking

Partial preview of the text

Download Android Application - Wireless Networks - Lecture Slides and more Slides Wireless Networking in PDF only on Docsity!

Android Application

Development Tutorial

Topics

 Background  Introduction to Android  Overview of Sensors  Programming Tutorial 1: Tracking location with GPS and Google Maps  Overview of Networking  Programming Tutorial 2: Downloading from the Internet  Programming Tutorial 3: Sending/Receiving SMS Messages  Questions/Comments  Resources

Background

 Software platform from Google and the Open Handset Alliance

 July 2005, Google acquired Android, Inc.

 November 2007, Open Handset Alliance formed to develop open standards for mobile devices

 October 2008, Android available as open source

 December 2008, 14 new members joined Android project

Update History

  • April 30, 2009: Official 1.5 Cupcake release
  • September 15, 2009: 1.6 SDK Donut release
  • October 26, 2009: 2.0 SDK Éclair release
    • Updates to the Éclair release:
      • 2.0.1 on December 3, 2009
      • 2.1 on January 12, 2010

Android and the Hardware

  • Built-in Apps ≡ Apps created in SDK
  • Leverage Linux kernel to interface with hardware
  • Open source platform promotes development from global community

Android Features

 Reuse and replacement of components  Dalvik virtual machine  Integrated browser  Optimized graphics  SQLite  Media support  GSM Telephony  Bluetooth, EDGE, 3G, and WiFi  Camera, GPS, compass, and accelerometer  Rich development environment

Application Fundamentals

  • Apps are written in Java
  • Bundled by Android Asset Packaging Tool
  • Every App runs its own Linux process
  • Each process has it’s own Java Virtual Machine
  • Each App is assigned a unique Linux user ID
  • Apps can share the same user ID to see each other’s files

Application Components

 Activity ◦ Present a visual user interface for one focused endeavor the user can undertake ◦ Example: a list of menu items users can choose from  Services ◦ ◦ Run in the background for an indefinite period of timeExample: calculate and provide the result to activities that need it  Broadcast Receivers ◦ Receive and react to broadcast announcements ◦ Example: announcements that the time zone has changed  Content Providers ◦ ◦ Store and retrieve data and make it accessible to all applicationsExample: Android ships with a number of content providers for common data types (e.g., audio, video, images, personal contact information, etc.)  Intents ◦ ◦ Hold the content of a messageExample: convey a request for an activity to present an image to the user or let the user edit some text

OVERVIEW OF SENSORS

The Android Sensor Platform and how to use it

Open Source Platform

  • Developer’s are able to access “goodies”
  • Hardware capabilities made available

Sensor and SensorManager

 Sensor type (Sensor class) ◦ Orientation, accelerometer, light, magnetic field, proximity, temperature, etc.  Sampling rate ◦ Fastest, game, normal, user interface. ◦ When an application requests a specific sampling rate, it is really only a hint, or suggestion, to the sensor subsystem. There is no guarantee of a particular rate being available.  Accuracy ◦ High, low, medium, unreliable.

PROGRAMMING TUTORIAL

Simulating an Android application that accesses positioning sensors

Get a Google Maps API Key

 A Google Maps API key is required to integrate Google Maps into your Androidapplication.  To apply for a key:

  1. Locate the SDK debug certificate in the default folder of "C:\Documents andSettings<username>\Local Settings\Application Data\Android". The filename of the debug
  2. keystore is debug.keystore.Copy the debug.keystore file to a folder named C:\Android.
  3. Open the command window and navigate to C:\ProgramFiles\Java<JDK_version_number>\bin to locate the Keytool.exe.
  4. Execute the following to extract the MD5 fingerprint: keytool.exestorepass android -list -alias -keypass androidandroiddebugkey -keystore "C:\Android\debug.keystore" -
  5. Copy the MD5 certificate fingerprint and navigate your web browser to:http://code.google.com/android/maps-api-signup.html.
  6. Follow the instructions on the page to complete the application and obtain the Google Mapskey. For more information on using Google Maps in Android application development: http://mobiforge.com/developing/story/using-google-maps-android

Create an Android Virtual Device (AVD)

 Defines the system image and device settings used by the Emulator

 To create an AVD in Eclipse:

  1. Select Window > Android SDK and AVD Manager. The Android SDK and AVD Manager displays.
  2. Make sure the entry for Virtual Devices is selected and click New. The Create new AVD window displays.
  3. Enter a Name for the AVD.
  4. Select Google APIs (API level 3) as the Target.
  5. Click Create AVD.
  6. Close the Android SDK and AVD Manager.