You are on page 1of 106

Android Application Development

Seminar on Getting Started

Ahsanul Karim
ahsanul.karim@sentinelbd.com

Sentinel Solutions Ltd.

Engineering Students Association of Bangladesh (ESAB)

http://www.sentinelbd.com http://androidstream.wordpress.com

Before Introduction

Before Introduction: Your Suggestions


1. Monotonous discussion should be banned

But, let me try after all its a free seminar. No ones going to kill me.

Before Introduction: Your Suggestions


2. This could be the first phase and it should be continued. 3. Arranging a workshop is better than seminar for the novice.

We have following probable plans:


1. 2. 3. 4. 5. Workshops Training Programs Onsite Contests with help from experienced Developers Idea-based Contests with help from experienced Developers Jamming Events

Depends on your feedback

Before Introduction: Your Suggestions


4. You can emphasize on learning OOPs before starting session on Android. Because very large number of Software Developer have no clear concept on OOP.
OOP concept is indispensable. But we have to learn in parallel.

5. It might get a little more interesting if the attendants are allowed to have the opportunity to play or use some of the android apps themselves.
Can you suggest how can we do that? May be next time well try. We may review some good apps today.

Before Introduction: Your Suggestions


6. If you give us some knowledge regarding to developing android software and how to post them in the android market it can be helpful to us in the future.
Well do that in this session

7. You can give us some video about mobile application programming which can help us.
Well provide you complete course content with video tutorials we did in BASIS (Bangladesh Association of Software & Information Services)

Before Introduction: Your Suggestions


8. Consider all type of audience.
Excellent suggestion. Well try that

9. Discuss from technological perspective as well as business


Excellent suggestion. Well try that

10. Forecast about near future associated with Android.


Excellent suggestion. Well try that

So Today
1. Get Basic Idea on Mobile and Smartphone Applications 2. Get Basic Idea on Mobile, Smartphone & Tablet Platforms 3. Identify the Position of Android Platform 4. Background and History of Android 5. Get the Idea: Why Should We Learn Android Platform 6. Opportunities 7. Some App Demos 8. System Architecture 9. Environment Setup to Kick-start 10. Application Structure 11. Cross-platform development 12. Resources

Mobile and Smartphone Applications


Mobile Phones
A mobile phone (also called mobile, cellular telephone, cell phone, or hand phone is an electronic device used to make 1. Calls across a wide geographic area. 2. Send Text SMS
3. 4. 5. 6. Can see call records Can capture image Can run music Can browse web etc.

To learn about mobile phones in details: http://en.wikipedia.org/wiki/Mobile_phone

Youll get detailed history about how this technology evolved over the years

Mobile and Smartphone Applications


Mobile Phone Applications: Some Examples Category: Utility Tools Personal Finance Calculator

Another example can be: Daily Planner Application Possible Features: 1. Task List 2. Reminder 3. Appointment etc.

Mobile and Smartphone Applications


Mobile Phone Applications: Some Examples (Contd.) Category: Games Sudoku Snake Tetris

Mobile and Smartphone Applications


Mobile Phone Applications: Development
1. Different Mobile phone vendor companies use different platforms for developing applications for their own platform. 2. Well discuss about a open Legacy platform as an example which is J2ME Java Platform, Micro Edition, or Java ME:
1. It is a Java platform designed for embedded systems (mobile

2.

Devices are one kind of such systems) . Target devices range from industrial controls to mobile phones with Java (KVM support). Formerly known as Java 2 Platform, Micro Edition (J2ME). For details: http://en.wikipedia.org/wiki/Java_Platform,_Micro_Edition

Nokia, Samsung, Sony Ericsson and many other vendors supports J2ME for applications and games development

Mobile and Smartphone Applications


Mobile Phone Applications: Development With J2ME Limitations
1. Memory Issues
1. 2. 3. Vendor Specific Implementation Insufficient Memory Inefficient Memory Management

2. 3. 4.

Device Compatibility Issues Not enough Access to Core System of the Phone Vendor Specific Implementation of KVM

That is why We see sites like this:

Mobile and Smartphone Applications


Smart Phones
1. A smartphone is a mobile phone that offers more advanced computing

ability, Features and connectivity


2. than a contemporary mobile phones. Smartphones may be thought of as handheld computers integrated with a mobile telephone. They also provide their own Operating System with Application Development Framework

3.

To learn about smart phones in details: http://en.wikipedia.org/wiki/Smartphone Youll get detailed history about how this technology evolved over the years

Mobile and Smartphone Applications


Smart Phones Platforms
Android iPhone BlackBerry Palm Pre

Mobile and Smartphone Applications


Tablet Platforms
Android: Galaxy Tab Apple: iPad

Overview of Application Platforms (alphabetically)


Platform
Android bada

Language (s)
Java, C, C++ C, C++

Remarks
Open Source OS (Based on Linux) http://developer.android.com Samsungs mobile platform running on Linux or RealTime OS http://developer.bada.com Java, Web Apps, Java ME compatible, extensions enable tighter integration http://na.blackberry.com/eng/developers Requires Apple Developer Account http://developer.apple.com/iphone Intel and Nokia guided open source OS (based on Linux) http://meego.com/developers OS built from the ground up for mobile devices http://www.forum.nokia.com/symbian

BlackBerry

Java, Web Apps

iOS MeeGo

Objective-C, C Qt, C++, others

Symbian

C, C++, Java, Qt, Web Apps, others

Overview of Application Platforms (Cont.)


Platform
webOS Windows Mobile Windows Phone

Language (s)
HTML, CSS, JavaScript, C C#, C

Remarks
Supports widget style programming (based on Linux) http://developer.palm.com .NET CF or Windows Mobile API, most devices ship with Java ME compatible JVM http://developer.windowsmobile.com Silverlight, XNA Frameworks http://create.msdn.com

C#, VB.NET

Source: http://mobileplatforms.wikidot.com/

Application Platforms

Why Android
They say a picture is worth a thousand words!!

Why Android (Cont.)


They say a picture is worth a thousand words!!

Why Android (Cont.)

Why Android (Cont.)

Why Android (Cont.)

Why Android (Cont.)

Why Android (Cont.)

Why Android (Cont.)

Why Android: Google TV

Why Android: Finally BlackBerry Gives In

Open Handset Alliance (Nov 2007)


Manufacturers: Designing the Android Handsets

Content Providers: Developing Apps

Mobile Operators

Markets: Distribution

Why Android (Cont.) What about ASIA-Pacific region???


Low cost devices from China manufacturers $96 Android devices

Why Android (Cont.)


Technical Advantages
No need to pay for any developers program to develop and test apps in real
devices

Open source platform with scope of more innovation


(Less proprietary restrictions)

Java programming language Rich and easy to integrate feature sets Easy, effective and cost-effective prototyping for research and business
Development Environment Support in Windows, Mac & Linux (Ubuntu)

Imagination is the Limit

Why Android (Cont.)


Business Advantages

Android market:
Integrated market app One time low registration fee

Many Distribution Channels:


(Well see next)

Low Barrier to Market:


No approval process Less restrictions with copyright issues

Why Android (Cont.)


Opportunities

Android market: (http://market.android.com)


Integrated Android Market Application in phones can ensure your reach to

millions of users without any approval process.

Amazon Appstore for Android:


http://www.amazon.com/mobile-apps/b?ie=UTF8&node=2350149011

Enterprise Market:
https://marketplace.cisco.com/

3rd Party Distribution Channels :


1. 6. Andspot 2. Handango 3. GetJar 4. SlideMe AndroLib 7. AppBrain and many more 5.AndAppStore

Why Android (Cont.)


Opportunities

Android Market: (1) Analytics to help decision making

Why Android (Cont.)


Opportunities

Android Market: (2) Crash log to support bug fixes

Why Android (Cont.)


Opportunities

Android Market: (3) Requirements

Why Android (Cont.)


Opportunities

Amazon Appstore for Android:

Why Android (Cont.)


Opportunities

Enterprise Market:

$ $

Why Android (Cont.)


Monetization Opportunities

Paid Apps $ $ $ $ $ $ $ In-App Billing Free Apps with Ads


AdMob AdWhirl Mobclix and many more

Why Android (Cont.)


Freelancing Opportunities Statistics
Source: http://www.elance.com/android-programmers-freelancers/230

Similar trend is seen in other freelancing sites Can be a good source of income to support your own product development or research

Why Android (Cont.)


Game Development Opportunities Case Study: AhhhPah http://ahhhpah.com/

Development Time: 8 hours Downloads: millions

Simplified Game frameworks 1. Libgdx: http://code.google.com/p/libgdx/ 2. AndEngine: http://www.andengine.org/ 3. Unity3d: http://unity3d.com/

Why Android (Cont.)


Some Interesting Apps
Shazam
Hear a song you don't know? Shazam identifies it instantly. INSTALLS:10,000,000 - 50,000,000

Why Android (Cont.)


Some Interesting Apps
Guitar : Solo Lite
INSTALLS:10,000,000 - 50,000,000

Why Android (Cont.)


My Story
ProTranslate
INSTALLS: 50,000 - 100,000

It gave us Googles Device Seeding Program Award Features: 1. Support for wide range of languages 2. Share translated text (Email,SMS,twitter,facebook) Pronounciation and speech output 3. Website translation Document translation and share via email 4. Auto-prompt to translate SMS received 5. Optimized for all Android devices

Why Android (Cont.)


My Story
ProTranslate

Why Android (Cont.)


Research Opportunities Easy Prototyping of any idea is possible in Android. Some of the advanced
research based projects are prototyped in Android.

mHealth
eMOCA (www.emocha.org) Developed by the Johns Hopkins Center for Clinical Global Health Education, eMOCHA uses video, audio, touchscreen quizzes, GPS and SMS to collect and analyze large amounts of data.

Why Android (Cont.)


Research Opportunities Easy Prototyping of any idea is possible in Android. Some of the advanced
research based projects are prototyped in Android.

mHealth
ClickDiagnostics
http://clickdiagnostics.com/

Developed by ClickDiagnostics, uses video, audio, touchscreen Quizzes to upload data to server to reach the consultants.

Why Android (Cont.)


Research Opportunities
mHealth

Clinical diagnosis + Data acquisition

Why Android (Cont.)


Research Opportunities Android + Arduino = Innovation Unlimited Arduino (http://www.arduino.cc/)
1. Arduino is an open-source electronics prototyping platform 2. can sense the environment by receiving input from a variety of sensors and can affect its surroundings by controlling lights, motors, and other actuators.
http://arduino.cc/blog/2011/10/12/androi d-open-2011-massimo-banzi-arduinoandroid-infinite-possibilities/

Why Android (Cont.)


Research Opportunities Android in Disaster Management
A Mobile Disaster Management System Using the Android Technology http://www.naun.org/journals/communications/19-280.pdf Implementation of an Android based disaster management system http://www.bcdph.com/download/android.pdf Android Incident Reporting for SAHANA Disaster Management System http://code.google.com/p/sahana-incident-reporter/

Case Study: Bangladesh Army


1. 2. 3. 4. Custom sensor device to accumulate weather data Create forecast Use data feeds to plan strategies for recovery Integrated solar cell for self sufficient power

Why Android (Cont.)


Application Development Opportunities Augmented Reality

Some more: http://techsplurge.com/3214/mega-list-33-awesome-augmented-reality-apps-games-android/

Real World Environment+ Sound, Video, Graphics data generated by systems= AR

Why Android (Cont.)


Research Opportunities Android in Space!!!

http://www.youtube.com/watch?v=REsEgrhmMjc

What is Android
Android is a software stack for mobile devices that includes an

operating system, middleware and key applications. The


Android SDK provides the tools and APIs necessary to begin developing applications on the Android platform using the Java programming language.

Google describes Android as: The first truly open and comprehensive platform for mobile devices, all of the software to run a mobile phone but without the proprietary obstacles that have hindered mobile innovation.

Android Features
Features
1. Application framework 2. Dalvik virtual machine 3. Integrated browser 4. Optimized graphics 5. SQLite Storage 6. Media support 7. GSM Telephony 8. Bluetooth, EDGE, 3G, and WiFi 9. Camera, GPS, compass, and accelerometer 10.Rich development environment

Android Features (Cont.)


Accelerometer GPS

Thermal Sensor

+
Gyroscope

Your App With logic to Actuate

Light Sensor Voice Search Magnetic Sensor

TTS

Android Architecture

Setting up Development Environment


System Requirements
Supported OS 1. Windows XP (32-bit), Vista (32- or 64-bit), or Windows 7 (32- or 64-bit) 2. Mac OS X 10.5.8 or later (x86 only) 3. Linux (tested on Ubuntu Linux, Lucid Lynx)

Supported Development Environment (Eclipse IDE based) 1. Eclipse 3.4 (Ganymede) or greater/Eclipse Classic (versions 3.5.1 and higher) 2. JDK 1.5 or 1.6 3. ADT Plugin

Setting up Development Environment(Contd.)


To set up the development environment, we need:
1. Java Development Kit (JDK 1.5+, 1.6 is preferable) 2. Eclipse IDE 3. Android SDK

Setting up Development Environment (Contd.)


Java Development Kit (JDK)
Download Link: http://www.java.com/en/download/index.jsp

Download JDK from here and Install JDK

Setting up Development Environment (Contd.)


Eclipse IDE
Download Link: http://eclipse.org/downloads/

Download the highlighted version of Eclipse IDE

Setting up Development Environment (Contd.)


Android SDK
Link: http://developer.android.com/sdk/index.html

Download and Install the SDK starter package from the table above (Highlighted)

Setting up Development Environment (Contd.)


Android SDK Setup (1)
1. Install available packages to get all SDK platform versions

Setting up Development Environment (Contd.)


Android SDK Setup (2)
2. Installation progress

Setting up Development Environment (Contd.)


Android SDK Setup (3)
3. ADT Plugin for Eclipse

ADT Plugin:
Android Development Tools (ADT) is a plugin for the Eclipse IDE for 1. 2. 3. 4. 5. extending the capabilities of Eclipse to set up new Android projects creating an application UI adding components based on the Android Framework API debugging your applications using the Android SDK tools exporting signed (or unsigned) APKs in order to distribute your application

Well see the 5 points gradually during development

Setting up Development Environment (Contd.)


Android SDK Setup (4)
4. Installing the ADT
1. Start Eclipse, then select Help > Install New Software.... 2. Click Add, in the top-right corner. 3. In the next window, you'll see a list of the tools to be downloaded. Click Next. 4. Read and accept the license agreements, then click Finish. 5. When the installation completes, restart Eclipse.

Setting up Development Environment (Contd.)


Android SDK Setup (5)
5. Set SDK path
1. Start Eclipse, then select Window > Preferences 2. Browse and show the path of Android SDK. 3. Press Apply and OK.

Development Environment Setup is now completed!

Setting up Development Environment (Contd.)


In Our Lab (1)
In our D:// Drive we get:

Setting up Development Environment (Contd.)


In Our Lab (2)
First we install JDK

We have already done that

Setting up Development Environment (Contd.)


In Our Lab (3.1) Well setup Eclipse Galileo

Setting up Development Environment (Contd.)


In Our Lab (3.2) Well setup Eclipse Galileo

You can create a shortcut in the desktop for eclipse.exe

Setting up Development Environment (Contd.)


In Our Lab (3.3) Well setup Eclipse Galileo

Choose your WorkSpace

Setting up Development Environment (Contd.)


In Our Lab (3.5) Well setup Eclipse Galileo

You have already seen this for previous case Helios Expecting a question

Setting up Development Environment (Contd.)


In Our Lab (3.6) Well setup Eclipse Galileo

Well become familiar to our new IDE gradually and I swear youll start loving it

Setting up Development Environment (Contd.)


In Our Lab (4.1) Well setup ADT Plugin

Setting up Development Environment (Contd.)


In Our Lab (4.2) Well setup ADT Plugin

Setting up Development Environment (Contd.)


In Our Lab (4.3) Well setup ADT Plugin

Setting up Development Environment (Contd.)


In Our Lab (4.4) Well setup ADT Plugin

Setting up Development Environment (Contd.)


In Our Lab (4.5) Well setup ADT Plugin

Setting up Development Environment (Contd.)


In Our Lab (4.6) Well setup ADT Plugin

Setting up Development Environment (Contd.)


In Our Lab (4.7) Well setup ADT Plugin

Adding ADT Pluging is DONE Youll now get a message

Setting up Development Environment (Contd.)


In Our Lab (5.1) Well setup android SDK
After restarting Eclipse we get:

Dont forget to ask me about the red marks

Setting up Development Environment (Contd.)


In Our Lab (5.2) Well setup android SDK
SDK and AVD Manager: If we click on it:

So, we have to set the location of Android SDK and show it to our IDE To do so.

Setting up Development Environment (Contd.)


In Our Lab (5.3) Well setup android SDK

Setting up Development Environment (Contd.)


In Our Lab (5.4) Well setup android SDK

Setting up Development Environment (Contd.)


In Our Lab (5.5) Well setup android SDK

Setting up Development Environment (Contd.)


In Our Lab (5.6) Well setup android SDK

Setting up Development Environment (Contd.)


In Our Lab (5.6) Well setup DDMS

Now We are Ready

Lets say Hello to the Android World! Now that our development environment is ready, well build our first Android application.
In the subsequent slides: 1. Well create an application step by step using the help of IDE and ADT. 2. Well then explain application structure and identify the building blocks. 3. Well experiment with components and learn to convert our innovative ideas into neat apps.

Lets say Hello to the Android World! (Contd.)


1. Start Eclipse and Go to File>New>Android Project 2. We keep project name Hello World (Since 1970 Ritchies book on C programming, programmers always say Hello World first) 3. Build Target Android1.6 4. Application name: Hello World 5. Package name: com.sentinelbd.hallo 6. Initial Activity Name: HalloActivity 7. Min SDK Version: 4 8. Click Finish

Congratulations! Youve just created your first Android application


Well explain each input shortly

Lets Go Deep
Created Project has the following structure Project Structure

-Source (src) -Generated Class (gen) -Android 1.6 library -Assets (assets) -Resource(res) -drawable-hdpi -drawable-ldpi -drawable-mdpi -layout -values -AndroidMenifest.xml -default.properties

Lets Go Deep (Contd.)


To run the app in emulator, we have to do the following steps: 1. Create AVD (Android Virtual Device) 2. Create Run Configuration 3. Run the Application To run the app in device, we have to do the following steps: 1. 2. 3. 4. Install device driver Connect device through USB Create Run Configuration Run the Application Well run the app in emulator for now

Lets Go Deep (Contd.)


1. Create AVD (Android Virtual Device)
Use Android SDK & AVD Manager to create AVD

Lets Go Deep (Contd.)


2. Create Run Configuration

1. Create a Run Configuration 2. Browse and select the project to run

Lets Go Deep (Contd.)


3. Select AVD & Run

Click Run to start AVD/emulator

Lets Go Deep (Contd.)


Result in Emulator

Now its time to analyze how it works

Project Structure
Created Project has the following structure Project Structure

-Source (src) -Generated Class (gen) -Android 1.6 library -Assets (assets) -Resource(res) -drawable-hdpi -drawable-ldpi -drawable-mdpi -layout -values -AndroidMenifest.xml -default.properties

Project Structure (Contd.)


-Source (src)
We have used only one class here which is an Activity named HalloActivity. Well describe about Activity in detail with lifecycle shortly. For now we can consider Activity as Android analogue for the window or dialog in a desktop application. It can load view from xml layout (here main.xml under res/layout folder)

In the HelloActivity class the view of the Activity is set from main.xml given below

Project Structure (Contd.)


-res/layout/main.xml
1. UI Layout can be defined from source code using View or by layout xmls. 2. The layout xml can be generated by visual tool given by ADT

Project Structure (Contd.)


-res/drawable
1. From Android 1.6 to support different screen sizes and screen densities graphic files are kept in 3 different folders drawable-hdpi, drawable-ldpi and drawable-mdpi 2. In our current project, they contain only default icon file with different dimensions to support devices with different screen resolution.

-assets
Holds other static files you wish packaged with the application for deployment onto the device. In this project, we have none

-gen/R.java

-values/strings.xml

Project Structure (Contd.)


-AndroidMenifest.xml

XML file describing the application being built and what components activities, services, etc. are being supplied by that application

Cross-platform Development
1. RhoMobile
http://rhomobile.com/

2. Appcelerator

http://www.appcelerator.com/

3. PhoneGap

http://www.phonegap.com/

Resources: DVD
DVD Content

Tutorials

Day Content
1. Video Tutorials 2. PPT Slides

Ebooks

Tools

Resources: Android Developers Site


http://developer.android.com

1. 2. 3. 4.

Tutorials & Design Guidelines SDK References Articles on Pragmatic & Good Practices & anything youll need including Google IO Videos

Resources: Open Source Projects


1. 2. http://code.google.com/p/apps-for-android/ http://en.wikipedia.org/wiki/List_of_open_source_Android_applications

Questions?

You might also like