Tehran's 1st Android bootcamp - Part1

Preview:

Citation preview

You’re Welcome toTehran 1st

Android BootcampHi

Android Overviewاندروید بر مروری

Android Means

an·droid /ˈanˌdroid/

Noun

(in science fiction)A robot with a human appearance.

Android…• Is an open source platform designed for mobiles

devices under licenses (Apache/MIT)• Is based on the open Linux kernel– Portability: easy to compile on various hardware– Security: a highly secure system– Features: support for memory management, power

management, and networking• Championed by Google• Separates the hardware from the software• Core is designed to be portable to run on all sorts of

physical devices and screen size

Android…• For Developers:– Provides all tools for developing mobile apps quickly and

easily– Don’t even need a physical phone to start developing

• For Users:– Can customize their phone experience

• For Manufacturers:– Complete solution for running their devices– Other than some hardware-specific drivers, provides

everything else to make their devices work.

Android Historyاندروید تاریخچه

History• In 2005, Google buys Android, Inc.• Everything goes quiet for a while!• In 2007, the Open Handset Alliance is announced. Android is

officially open sourced.• In 2008, the Android SDK 1.0 is released. The G1 phone,

manufactured by HTC and sold by the wireless carrier T-Mobile USA, follows shortly afterward.

• 2009 sees a proliferation of Android-based devices. New versions of the operating system are released: Cupcake (1.5), Donut (1.6), and Eclair (2.0 and 2.1). More than 20 devices run Android.

• • In 2010, Android is second only to Blackberry as the best-selling smart phone platform. Froyo (Android 2.2) is released and so are more than 60 devices that run it.

Android Versionsاندروید نسخه‌های

Android Versions

Two Pre-commercial internal release versions (2007–2008)• Android alpha:– Released before 5 Nov 2007– Code-named “Astro Boy”, “Bender”, “R2-D2”

• Android beta:– Released on 5 Nov 2007 ~ 28 Sep 2008– Code-named “m3-rc22a”, “m3-rc37a”, …

Android VersionsCupcake 1.5 2009/04/30

• HTC Dream, the first Android device

• Features: android market, web browser, camera support, gmail, Google contact, calendar, maps, sync, search, talk, media player, notification, voice dialer, you tube, …

Android VersionsDonut 1.6 2009/09/15

• based on Linux kernel 2.6.29

• Features: Voice and text entry search, Multilingual speech synthesis, faster camera access, technology support for CDMA/EVDO, 802.1x, VPNs, …

Android VersionsÉclair 2.0, 2.12009/10/29

• based on Linux kernel 2.6.29

• Features: Bluetooth 2.1 support, Camera flash support, digital zoom, scene mode, white balance, color effect and macro focus, live wallpapers, …

Android VersionsFroyo 2.2(frozen yogurt) 2010/05/20• based on Linux kernel

2.6.32• Speed, memory, and

performance optimizations, Android Cloud to Device Messaging (C2DM), USB tethering and Wi-Fi hotspot, file upload fields in the Browser, Adobe Flash support, …

Android Versions

Gingerbread 2.32010/12/06

• based on Linux kernel 2.6.35

• Features: Switched from YAFFS to ext4, enhancements for game developers, Support for extra-large screen sizes and resolutions, …

Android VersionsHoneycomb 3.0 2011/02/22• the first tablet-only Android

update• Linux kernel 2.6.36• First Tablet, Motorola Xoom• Features: Optimized tablet

support, System Bar (notifications, status, and soft navigation buttons), Action Bar, Simplified multitasking, ...

Android VersionsIceCream Sandwich 4.0 2011/10/19

• based on Linux kernel 3.0.1• compatible with any

Android 2.3.x device • Features: Multiple user

accounts , Face Unlock, Google Chrome browser, syncing users' Chrome bookmarks, …

Android VersionsJelly Bean 4.2 2012/06/09

• based on Linux kernel 3.0.31• improving functionality and

performance of user interface.

• the first device Nexus 7 tablet• Bi-directional text and other

language support• Offline voice dictation

Android Futureاندروید آینده

Android Management Switch UpAndy Rubin, head of Android at Google, moved on to a new role at the company.

Sundar Pichai (Pichai Sundarajan), head of Chrome and Apps, is now in charge of Android.

2013/03/13

Google's Android Statue Gets a Chrome Update

• The new statue is mounted on Building 45

• perhaps some sort of Chrome-Android integration

• But It Doesn’t Mean Anything!…

Android Next Version

• Google's "sweet" naming convention• Every major release since Cupcake has been

named after a confection in alphabetical order• Cupcake > Donut > Eclair > Froyo

> Gingerbread > Honeycomb > IceCream Sandwich > JellyBean > K...!

Android Websites

• www.android.com• developer.android.com• Play.google.com• www.stackoverflow.com• www.openhandsetalliance.com

Installing the Android SDKاندروید نویسی برنامه ابزار نصب

SDK: Android Software Development Kithttp://developer.android.com/sdk/index.html

Installing the Android ADT• Download ADT, unzip (or on Linux, untar) it into an

easy access folder (for example)– Windows

• C:\apps\android-adt-windows– Linux

• /home/YourUserName/android-adt-linux_86– Mac OS X

• /Users/YourUserName/android-adt-mac_86• For Windows strongly recommend directories

without spaces

Hello, Worldاندروید پروژه اولین ایجاد

Creating a New ProjectFile→New→Project→Android Application Project

Creating a New Project• In Eclipse choose,– File→New→Project→Android Application Project

• Application Name:– The name of your application

• Project Name:– Eclipse organizes everything into projects– project name should be one word and CamelCase

• Package Name:– In Java, all source code is organized into packages– Your package name (reverse of your domain name)

Creating a New Project• Minimum required SDK:– minimum version of Android that is required for the

device to run this application• Target SDK:– tells the build tools which version of the Android

platform you are building for• Compile with:– Typically the most recent version that support all API

• Theme:– Base theme to user for application

Configure ProjectNew Android application→Next

Configure New Project

• Create custom launcher icon:– Check to use a simple icon creator

• Create activity:– Check to use activity creator tool

• Mark this project as library:– Check if you want to create a library project to use

in other projects

Android Project Partsاندروید پروژه یک بخشهای

Android Project Important Parts

• Manifest File• Layout XML Code• Strings• The R File• Java Source Code

Manifest File

• Glues everything together• Explains what the application consists of• What all its main building blocks are• What permissions it requires• What is the application name, application icon• What is package name, version Code & Name• …

Layout XML CodeXML file specifies the layout of your screen

Layout XML Code

• XML file specifies the layout of your screen– TextView– Spinner– Button– ImageView

StringsXML file that contains all the text that your application uses

Strings

• XML file that contains all the text that your application uses:– names of buttons– labels– default text– and similar types of strings…

The R FileGlue between the world of Java and the world of resources

The R File

• Glue between the world of Java and the world of resources

• Automatically generated file, and you never modify it

• Recreated every time you change anything in the res directory

Java Source CodeIs what drives everything

Java Source Code

• Is what drives everything• Code that ultimately gets converted to a Dalvik

executable

The Emulatorاندروید مجازی ماشین

The Emulator

• Is an actual code emulator• It runs the same code base as the actual device• Have to create an Android Virtual Device

(AVD), To use the emulator

Emulator vs. Simulator

• sound very similar, but are fundamentally different

• To emulate means to imitate the machine executing the binary code

• An emulator is sort of like a virtual machine• A simulator merely simulates the behavior of

the code at a higher level

Android Virtual Device (AVD)

Android Virtual Device (AVD)

• Start the tool called Android SDK and AVD Manager with in SDK folder

• Choose “New…”• In Create New AVD dialog window, you must

specify some parameters for your new AVD

Android Virtual Device (AVD)

New AVD Dialog• Name:

– can be any name you choose• Device:

– Device that emulator look like• Target:

– designates which version of Android– based on platforms and add-ons downloaded and installed

• Keyboard• Skin• Front Camera• Ram, Internal Storage, SD Card

Emulator with -Android 4.2.2 AVD

Let’s get to work…