SlideShare a Scribd company logo
PERKYTORIAL
Topic: Getting Started with Android
Programming
Overview
 Introduction to Android
 App Store and Business Model
 Apps Publication Process
 Environment Setup and SDK Overview
 Project Creation & Components
 Apps Execution and Debugging
Introduction to Android
What is Android?
Phones
HTC Nexus Samsung
Tablets
Nexus 7Walton Primo Walpad 7Samsung Galaxy Tab
Smartphone Vs Traditional Phone
Smartphone
 Internet Capability
 Adding Features
Regular Phone
Sending and receiving
text and calls.
In a word,
Smart phones are capable of adding and removing new features,
but regular phones are based on embedded capabilities.
Multiple apps can be run on smartphone simultaneously,
whereas, regular phones can do only one task at a time
Brief History
Honeycomb
Android 3.0-3.2
Gingerbread
Android 2.3
Kitkat
Android 4.4
2009 2009 2009 2010 2010 2011
2011
Ice cream Sandwich
Android 4.0
2013 2012
Why Android?
• Supported by Google.
• It is simple and powerful SDK.
• Licensing, Distribution or Development fee is not
required.
Easy to Import third party Java library.
• Supporting platforms are – Linux, Mac Os, Windows.
• Innovative products like the location-aware services,
location of a nearby convenience store etc., are some of
the additive facilities in Android.
Categories of Mobile Apps
(Cont.)
 Health, Fitness and Medical
Recipe
Blood Pressure Watch
Pregnancy +
Categories of Mobile Apps (Cont.)
 Games
Temple Run
Fruit Ninja
Candy Crush Saga
Categories of Mobile Apps (Cont.)
Communication
Skype
Voip Applications
Facebook
Categories of Mobile Apps (Cont.)
 Business and Finance
Ebay
Online Banking System
Expense Manager
App Store and Business Model
• An application store (sometimes also referred to as an app
store, app marketplace, or variations) is a type of digital
distribution platform for application software, often provided as
a component of an operating system on a personal
computer, smartphone, or tablet.
• Application stores typically take the form of an online store,
where users can browse through different categories and genres
of applications (such as for example, productivity, multimedia,
and games), view information and reviews of then, purchase it (if
necessary), and then automatically download and install the
application on their device.
App Store
Popular App Stores:
Google Play (Android Based)
Apple Store (iOS Based)
Market Place (Windows Based)
Opera (Android, iOS, Windows, Blackberry, Java)
EATLApps (Android) – The First ever in Bangladesh
App Store and Business Model
The Mobile network is the world’s
largest distribution &
communication platform, with more
than
6,000,000,0000
(six billion) subscribers worldwide.
Mobile Apps Life Cycle
App Store and Business Model
The apps developer program provides you with the ability to
distribute your apps on the appstore. Offer your free or
commercial apps to millions of android phone customers
around the world. Extend the ability to generate revenue from
your apps on the appstore.
Revenue Sharing
For applications and all in-app products that you choose to
sell on EATLAPPS, the transaction fee is equivalent to 30% of
the price. You receive 70% of the payment and the remaining
30% goes to the distribution partner and operating fees.
Apps Publication Process
Publishing is the general process that makes your Android
applications available to users. When you publish an Android
application you perform two main tasks:
• You prepare the application for release. During the preparation
step you build a release version of your application, which users
can download and install on their Android-powered devices.
• You release the application to users. During the release step you
publicize, sell, and distribute the release version of your
application to users.
Versioning Your Applications
Versioning is a critical component of your application upgrade and
maintenance strategy. Versioning is important because users need
to have specific information about the application version that is
installed on their devices and the upgrade versions available for
installation.
Specifying Application's System API(Application Programming
Interface)
If your application requires a specific minimum version of the Android platform,
or is designed only to support a certain range of Android platform versions, you
can specify those version requirements as API Level identifiers in the
application's manifest file. Doing so ensures that your application can only be
installed on devices that are running a compatible version of the Android system.
To specify API Level requirements, add a <uses-sdk> element in the application's
manifest, with one or more of these attributes:
•android:minSdkVersion.
•android:targetSdkVersion
•android:maxSdkVersion
Signing Your Applications
 The Android system requires that all installed applications
be digitally signed with a certificate whose private key is
held by the application's developer.
 The Android system uses the certificate as a means of
identifying the author of an application and establishing
trust relationships between applications.
 The certificate is not used to control which applications the
user can install.
 The certificate does not need to be signed by a certificate
authority: it is perfectly allowable, and typical, for Android
applications to use self-signed certificates.
Environment Setup
• Install JDK 6, or 7
• Install Eclipse IDE for Java EE Developers (version 3.7 -
Indigo)
• Download and unpack the Android SDK
• Install Android Development Tools (ADT) plugin for
Eclipse
• Detailed install instructions available on Android site
http://developer.android.com/sdk/installing.html
ADT Plugin
• In Eclipse, go to Help -> Install New Software
• Click ‘Add’ in top right
• Enter:
– Name: ADT Plugin
– Location: https://dl-ssl.google.com/android/eclipse/
• Click OK, then select ‘Developer Tools’, click Next
• Click Next and then Finish
• Afterwards, restart Eclipse
• Specify SDK location (next 3 slides)
Specify SDK location
Specify SDK location
Getting started with android programming
Android Emulator or AVD
• Emulator is essential to testing app but is not a substitute
for a real device
• Emulators are called Android Virtual Devices (AVDs)
• Android SDK and AVD Manager allows you to create
AVDs that target any Android API level
• AVD have configurable resolutions, RAM, SD cards,
skins, and other hardware
Preparing android device
Getting started with android programming
Getting started with android programming
Android Emulator: 2.2 Device
Android Emulator: 4.2 Device
Android Architecture
Linux Kernel
• Works as a HAL(Hardware Abstraction Layer)
• Device drivers
• Memory management
• Process management
• Networking
Libraries
• C/C++ libraries
• Interface through Java
• Surface manager – Handling UI Windows
• 2D and 3D graphics
• Media codecs, SQLite, Browser engine
Android Runtime
• Dalvik VM
– Dex files
– Compact and efficient than class files
– Limited memory and battery power
• Core Libraries
– Java 5 Std edition
– Collections, I/O etc…
Application Framework
• API interface
• Activity manager – manages application life
cycle.
Applications
• Built in and user apps
• Can replace built in apps
Project Creation & Components
Getting started with android programming
Getting started with android programming
Getting started with android programming
Getting started with android programming
Getting started with android programming
Getting started with android programming
Hello Android Tutorial
Important Files
• src/HelloAndroid.java
– Activity which is started when app executes
• res/layout/main.xml
– Defines & lays out widgets for the activity
• res/values/strings.xml
– String constants used by app
• gen/R.java (Don’t touch!)
– Auto-generated file with identifiers from main.xml, strings.xml, and elsewhere
• AndroidManifest.xml
– Declares all the app’s components
– Names libraries app needs to be linked against
– Identifies permissions the app expects to be granted
src/HelloAndroid.java
• Activity which is started when app executes
res/layout/main.xml
• Declares layouts & widgets for the activity
Tree from: http://developer.android.com/guide/topics/ui/index.html
res/values/strings.xml
• String constants used by app
• Used for supporting Localization
– res/values-es/values/strings.xml to support Spanish
– res/values-fr/values/strings.xml to support French
– Etc.
gen/R.java
▪ Auto-generated file with identifiers from main.xml, strings.xml, and
elsewhere
Do not
modify!
AndroidManifest.xml
▪ Declares all the app’s components
▪ Names libraries app needs to be linked against
▪ Identifies permissions the app expects to be granted
Manifest
• Contains characteristics about your application
• When have more than one Activity in app, NEED to specify it in
manifest file
– Go to graphical view of the manifest file
– Add an Activity in the bottom right
– Browse for the name of the activity
• Need to specify Services and other components too
• Also important to define permissions and external libraries, like Google
Maps API
Manifest File – Adding an Activity
Debugging
• Instead of using traditional System.out.println, use the Log class
– Imported with android.util.Log
– Multiple types of output (debug, warning, error, …)
– Log.d(<tag>,<string>)
• Can be read using logcat.
– Print out the whole log, which auto-updates
• adb logcat
– Erase log
• adb logcat –c
– Filter output via tags
• adb logcat <tag>:<msg type> *:S
• can have multiple <tag>:<msg type> filters
• <msg type> corresponds to debug, warning, error, etc.
• If use Log.d(), then <msg type> = D
USB Debugging
• Should be enabled on phone to use developer
features
• In the main apps screen select Settings ->
Applications -> Development -> USB debugging (it
needs to be checked)
References
• http://biobio.loc.edu/chu/web/Courses/JAVA1/Ch4/S
election.htm
• http://docs.oracle.com/javase/tutorial/essential/io/str
eams.html
• http://developer.android.com
• http://mobile.tutsplus.com

More Related Content

Getting started with android programming

  • 1. PERKYTORIAL Topic: Getting Started with Android Programming
  • 2. Overview  Introduction to Android  App Store and Business Model  Apps Publication Process  Environment Setup and SDK Overview  Project Creation & Components  Apps Execution and Debugging
  • 5. Tablets Nexus 7Walton Primo Walpad 7Samsung Galaxy Tab
  • 6. Smartphone Vs Traditional Phone Smartphone  Internet Capability  Adding Features Regular Phone Sending and receiving text and calls. In a word, Smart phones are capable of adding and removing new features, but regular phones are based on embedded capabilities. Multiple apps can be run on smartphone simultaneously, whereas, regular phones can do only one task at a time
  • 7. Brief History Honeycomb Android 3.0-3.2 Gingerbread Android 2.3 Kitkat Android 4.4 2009 2009 2009 2010 2010 2011 2011 Ice cream Sandwich Android 4.0 2013 2012
  • 8. Why Android? • Supported by Google. • It is simple and powerful SDK. • Licensing, Distribution or Development fee is not required. Easy to Import third party Java library. • Supporting platforms are – Linux, Mac Os, Windows. • Innovative products like the location-aware services, location of a nearby convenience store etc., are some of the additive facilities in Android.
  • 9. Categories of Mobile Apps (Cont.)  Health, Fitness and Medical Recipe Blood Pressure Watch Pregnancy +
  • 10. Categories of Mobile Apps (Cont.)  Games Temple Run Fruit Ninja Candy Crush Saga
  • 11. Categories of Mobile Apps (Cont.) Communication Skype Voip Applications Facebook
  • 12. Categories of Mobile Apps (Cont.)  Business and Finance Ebay Online Banking System Expense Manager
  • 13. App Store and Business Model • An application store (sometimes also referred to as an app store, app marketplace, or variations) is a type of digital distribution platform for application software, often provided as a component of an operating system on a personal computer, smartphone, or tablet. • Application stores typically take the form of an online store, where users can browse through different categories and genres of applications (such as for example, productivity, multimedia, and games), view information and reviews of then, purchase it (if necessary), and then automatically download and install the application on their device.
  • 14. App Store Popular App Stores: Google Play (Android Based) Apple Store (iOS Based) Market Place (Windows Based) Opera (Android, iOS, Windows, Blackberry, Java) EATLApps (Android) – The First ever in Bangladesh
  • 15. App Store and Business Model The Mobile network is the world’s largest distribution & communication platform, with more than 6,000,000,0000 (six billion) subscribers worldwide.
  • 17. App Store and Business Model The apps developer program provides you with the ability to distribute your apps on the appstore. Offer your free or commercial apps to millions of android phone customers around the world. Extend the ability to generate revenue from your apps on the appstore. Revenue Sharing For applications and all in-app products that you choose to sell on EATLAPPS, the transaction fee is equivalent to 30% of the price. You receive 70% of the payment and the remaining 30% goes to the distribution partner and operating fees.
  • 18. Apps Publication Process Publishing is the general process that makes your Android applications available to users. When you publish an Android application you perform two main tasks: • You prepare the application for release. During the preparation step you build a release version of your application, which users can download and install on their Android-powered devices. • You release the application to users. During the release step you publicize, sell, and distribute the release version of your application to users.
  • 19. Versioning Your Applications Versioning is a critical component of your application upgrade and maintenance strategy. Versioning is important because users need to have specific information about the application version that is installed on their devices and the upgrade versions available for installation.
  • 20. Specifying Application's System API(Application Programming Interface) If your application requires a specific minimum version of the Android platform, or is designed only to support a certain range of Android platform versions, you can specify those version requirements as API Level identifiers in the application's manifest file. Doing so ensures that your application can only be installed on devices that are running a compatible version of the Android system. To specify API Level requirements, add a <uses-sdk> element in the application's manifest, with one or more of these attributes: •android:minSdkVersion. •android:targetSdkVersion •android:maxSdkVersion
  • 21. Signing Your Applications  The Android system requires that all installed applications be digitally signed with a certificate whose private key is held by the application's developer.  The Android system uses the certificate as a means of identifying the author of an application and establishing trust relationships between applications.  The certificate is not used to control which applications the user can install.  The certificate does not need to be signed by a certificate authority: it is perfectly allowable, and typical, for Android applications to use self-signed certificates.
  • 22. Environment Setup • Install JDK 6, or 7 • Install Eclipse IDE for Java EE Developers (version 3.7 - Indigo) • Download and unpack the Android SDK • Install Android Development Tools (ADT) plugin for Eclipse • Detailed install instructions available on Android site http://developer.android.com/sdk/installing.html
  • 23. ADT Plugin • In Eclipse, go to Help -> Install New Software • Click ‘Add’ in top right • Enter: – Name: ADT Plugin – Location: https://dl-ssl.google.com/android/eclipse/ • Click OK, then select ‘Developer Tools’, click Next • Click Next and then Finish • Afterwards, restart Eclipse • Specify SDK location (next 3 slides)
  • 27. Android Emulator or AVD • Emulator is essential to testing app but is not a substitute for a real device • Emulators are called Android Virtual Devices (AVDs) • Android SDK and AVD Manager allows you to create AVDs that target any Android API level • AVD have configurable resolutions, RAM, SD cards, skins, and other hardware Preparing android device
  • 33. Linux Kernel • Works as a HAL(Hardware Abstraction Layer) • Device drivers • Memory management • Process management • Networking
  • 34. Libraries • C/C++ libraries • Interface through Java • Surface manager – Handling UI Windows • 2D and 3D graphics • Media codecs, SQLite, Browser engine
  • 35. Android Runtime • Dalvik VM – Dex files – Compact and efficient than class files – Limited memory and battery power • Core Libraries – Java 5 Std edition – Collections, I/O etc…
  • 36. Application Framework • API interface • Activity manager – manages application life cycle.
  • 37. Applications • Built in and user apps • Can replace built in apps
  • 38. Project Creation & Components
  • 46. Important Files • src/HelloAndroid.java – Activity which is started when app executes • res/layout/main.xml – Defines & lays out widgets for the activity • res/values/strings.xml – String constants used by app • gen/R.java (Don’t touch!) – Auto-generated file with identifiers from main.xml, strings.xml, and elsewhere • AndroidManifest.xml – Declares all the app’s components – Names libraries app needs to be linked against – Identifies permissions the app expects to be granted
  • 47. src/HelloAndroid.java • Activity which is started when app executes
  • 48. res/layout/main.xml • Declares layouts & widgets for the activity Tree from: http://developer.android.com/guide/topics/ui/index.html
  • 49. res/values/strings.xml • String constants used by app • Used for supporting Localization – res/values-es/values/strings.xml to support Spanish – res/values-fr/values/strings.xml to support French – Etc.
  • 50. gen/R.java ▪ Auto-generated file with identifiers from main.xml, strings.xml, and elsewhere Do not modify!
  • 51. AndroidManifest.xml ▪ Declares all the app’s components ▪ Names libraries app needs to be linked against ▪ Identifies permissions the app expects to be granted
  • 52. Manifest • Contains characteristics about your application • When have more than one Activity in app, NEED to specify it in manifest file – Go to graphical view of the manifest file – Add an Activity in the bottom right – Browse for the name of the activity • Need to specify Services and other components too • Also important to define permissions and external libraries, like Google Maps API
  • 53. Manifest File – Adding an Activity
  • 54. Debugging • Instead of using traditional System.out.println, use the Log class – Imported with android.util.Log – Multiple types of output (debug, warning, error, …) – Log.d(<tag>,<string>) • Can be read using logcat. – Print out the whole log, which auto-updates • adb logcat – Erase log • adb logcat –c – Filter output via tags • adb logcat <tag>:<msg type> *:S • can have multiple <tag>:<msg type> filters • <msg type> corresponds to debug, warning, error, etc. • If use Log.d(), then <msg type> = D
  • 55. USB Debugging • Should be enabled on phone to use developer features • In the main apps screen select Settings -> Applications -> Development -> USB debugging (it needs to be checked)