Transcript Slide 1

Android Outlook
• Android captures a majority of the smart phone market
• It is making significant inroads into the high end iPad tablet market.
• Amazon and Barnes and Noble are gaining popularity with the 7”
low cost ($100 to $200) tablets.
• Androids will be the base OS for a variety of other low cost devices
such as wrist watches, head phones, CD/DVD players, smart TVs,
and credit card replacements
• Android is capable to drive laptop and NetBook computers, though
its impact in these areas are limited to date.
• According to the text, 850,000 Android devices are activated daily.
Note: It is possible to dual boot iOS/Androids on a jail broken
iPhone or iPodTouch with OpeniBoot and iDroid software
Why Android?
• General Advantages
– Fully open-source, non-proprietary, operating system supported by
the Open Handset Alliance of 80 major manufacturers
– No certification process to become an Android developer
– No preferences for native applications
– Low learning curve for Java developers
• Rapid innovations such as:
– Android Beam; Near Field Communication (NFC) technology for near
device data exchange
– Home widgets and live wallpaper
– Shared data between applications
– Google map integration with Android applications
– On board SQL-lite
– Background services and applications
Application Security
• Applications can store data persistently with
the following limitations
– They can only write to their own data folders
– They must request user permission for access to
services such as: internet access, audio recording,
and near field device interaction, SD card
– Inherits low level Linux securities
– Applications can create content managers to
expose their data to selected other applications
Versions
Philosophy: Release early and often, with backward compatibility when
possible. Active devices run using many of the nineteen Android versions
• 2: Gingerbread still used by some android smart phones
• 3: Honeycomb (May 2011. Experimental)
– Used by the Motorola Xoom
– Source code withheld by Google
– Intended for larger screen, multi-core tablets, not smart phones
• 4: Ice Cream Sandwich (October 2011)
– Source code released by Google
– Brings honeycomb features to smart phones
– Facial recognition, better photography, offline functionality,
application folders
Mobile Device Hardware
• RISC Processors
– Low power; ideal for mobile devices
– Simple processors (35000 transistors per chip is typical)
• ARM
– Dominates the mobile technology market
– No microcode, Most instructions are single cycle
– Conditional execution and switched register banks
• MIPS
–
–
–
–
All instructions are single cycle
Loads data/instruction in one cycle
Eliminates multiply/divide to allow very high clock rates
Register windows speed up subroutine calls, but limits the
number of nested calls
Developing Android Applications
• Java using the Android Software Development Kit (ADK)
o Most Android applications are developed with the ADK
o Code in Java, then compile into Dalvik executables, which run in a
specialized virtual machine optimized for mobile devices
• C and C++ using the Native Development Kit (NDK)
o Does not significantly improve performance in most cases
o Useful for CPU-intensive operations such as signal processing
o The Android framework provides two ways to access C/C++ code
 The Java Native Interface (JNI)
 The NativeActivity class to interact with Services & Content Providers
• Google App Inventor
o For Novice programmers, who want to create Android applications
o Created by Google, maintained by MIT
o Apps created by drag-and-dropping visual objects
Second Presentation
Pick one of the following (or another if approved)
1.
2.
Describe how they work
Create a short demo if possible
Possible Selections
• Google App Inventor
• Native Development Kit
• Android features not discussed in class (Examples: Web View, Media
Frameworks, OPENGL for 2D/3D Animation, Telephony, Location-based
Services, Networks, Using Sensors, Home Screen Widgets and Live
wallpaper, NFC, Web View
• Manufacturer specific development kits
• Google’s stand alone API recently released
Mobile Development
Considerations
• User Priorities: 1. Phone, 2. Text messaging, 3. Camera, 4. MP3 Player, 5.
Other useful things like Google Maps, Browsing, Facebook, and applications.
– Never interrupt a user activity, instead use the led notification light,
vibration, message bar, or ringtones
– Always be polite
– Applications should be intuitive, easy to use, and conform to standards
• Limited battery life: Detect when the battery is not charging and
avoid compute-bound operations if this is the case.
• Life cycle: Applications do not control when they start or end.
Seamlessly respond to applications being paused and restarted
Considerations (cont.)
• Messaging costs
– Let users choose between high accuracy/fast/high cost
transmission and low accuracy/slow/low cost messaging
– Consider frequency and times of updates and minimize the
amount of data transferred
– Transfer at off-peak periods
– Always respect user preferences
• Limited processing power
– Code should be as efficient as possible
– Make use of background services and worker threads to
maximize responsiveness
– Save and restore processing states
Additional Considerations
• Limited persistent storage
– Applications should cache data when possible
– Manage data stores to remove unneeded data faithfully
• Limited memory sizes
– Minimize application size
– Obfuscate code to minimization footprint and reduce reverse
engineering (Pro Guard Java class shrinker)
• Intermittent or unreliable connections
– Graceful degradation for seamless operation
– Revert to limited operation or previously cached data
• Varied screens
– Different user interfaces other than buttons and text boxes
– Detect orientation changes
– Accommodate various display resolutions
Additional Considerations (cont.)
• Consider the users that might use applications
– Android devices are sold in hundreds of countries
having different languages spoken and different
cultures
– People with disabilities need font size options or
audio interfaces
– Be liberal with user preferences
• Consider state-of-the-art device features
– Utilize device features when they exist
Setting up the ADK
Step 1:Java (JDK 5 or later)
1. MAC: Normally comes with Java preloaded
2. Windows (Only the JDK, not the bundles):
a. Download:
www.oracle.com/technetwork/java/javase/downloads/index.html
b. Environment Variable, JAVA_HOME
My Computer, right click, Properties, Advanced, Environment Variables, New,
Javva_Home, C:\Program Files\Java\jdk<version>
3. Linux:
a. Download: sudo apt-get instal openjdk-7-jdk
b. Use downloaded version: sudo update-alternatives –config java
c. Environment variable: Edit .profile file
export JAVA_HOME=<path to JDK>
Setting up the ADK (cont.)
Step 2: Eclipse (Version 3.6 or later)
1. Download: www.eclipse.org/downloads/
2. Distribution is a compressed .zip file
a. Windows: Extract the zip file into c:\eclipse
Note: some versions don’t like spaces in the filenames
b. MAC: Extract into the Applications folder
c. Linux: Extract into the home directory
3. Executing: set a workspace location, which is a folder
under your home directory (or on the p: drive)
Note: Lab computer will have Eclipse set up along with the
Android Emulator. To work with the on-campus system, set your
workspace to a folder withinin your p: or travel disk drive.
Setting up the ADK (cont.)
Step 3: The Android Emulator
This step allows us to develop without actually having an
android phone or tablet device
1. Download: http://developer.android.com/sdk
2. Unpack the distribution compressed zip file
a.
b.
Windows: c:\android-sdk-windows (no spaces)
MAC and Linux: unpack to your home directory
3. Run the Android SDK Manager (its in the installation folder)
a.
b.
Choose Available packages and install
Include SDK Platform Tools, Documentation
4. Modify the PATH environment variable
a.
Add Android SDK tools, platforms tools, and Java bin directories
Note: On lab computers, this step should already be complete
Setting up the ADK (cont.)
Step 4: The Android Development Tools
This step will be necessary on lab computers
1. Eclipse -> help -> install new software
a. Work with field, Type: http://dl-ssl.google.com/android/eclipse/
b. Developer tools -> next -> accept license -> finish
2. Eclipse -> window -> preferences -> Android
a. SDK location: type the location of the android SDK. Click Apply.
3. You can bring up the emulator from within Eclipse
a. Window -> Android SDK and AVD manager
Application Structure
Created application (Helloharveyd.apk)
•
•
•
•
An .apk extension (Android package, which is standard compression)
Most compression utilities don’t recognize this extension.
Renaming to .zip enables .apk files to be unzipped.
The Android builder compiles many of the contained files
An Android package
• AndroidManifest.xml
–
–
–
–
•
•
•
•
Lists application activities (user tasks) and services
Lists permissions, and features required by the application
List permissions granted for access by other applications
Lists features used by this application
src: Source Java classes
bin: Compiled Java and Android classes
assets: Arbitrary collection of files and folders
res
– Various resource folders to separate data from application code
– Multimedia, user interface layouts, xml files, data values
abstracted from the application, and raw data
• gen: Java files automatically generated during a build
Android Build Process
The Build Process
Activity Life
Cycle
Loads into
memory
Note: The Dalvik VM controls the Life cycle, not the application