58
You’re Welcome to Tehran 1 st Android Bootcamp Hi

Tehran's 1st Android bootcamp - Part1

Embed Size (px)

Citation preview

Page 1: Tehran's 1st Android bootcamp - Part1

You’re Welcome toTehran 1st

Android BootcampHi

Page 2: Tehran's 1st Android bootcamp - Part1

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

Page 3: Tehran's 1st Android bootcamp - Part1

Android Means

an·droid /ˈanˌdroid/

Noun

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

Page 4: Tehran's 1st Android bootcamp - Part1

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

Page 5: Tehran's 1st Android bootcamp - Part1

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.

Page 6: Tehran's 1st Android bootcamp - Part1
Page 7: Tehran's 1st Android bootcamp - Part1

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

Page 8: Tehran's 1st Android bootcamp - Part1

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.

Page 9: Tehran's 1st Android bootcamp - Part1
Page 10: Tehran's 1st Android bootcamp - Part1

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

Page 11: Tehran's 1st Android bootcamp - Part1

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”, …

Page 12: Tehran's 1st Android bootcamp - Part1

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, …

Page 13: Tehran's 1st Android bootcamp - Part1

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, …

Page 14: Tehran's 1st Android bootcamp - Part1

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, …

Page 15: Tehran's 1st Android bootcamp - Part1

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, …

Page 16: Tehran's 1st Android bootcamp - Part1

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, …

Page 17: Tehran's 1st Android bootcamp - Part1

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, ...

Page 18: Tehran's 1st Android bootcamp - Part1

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, …

Page 19: Tehran's 1st Android bootcamp - Part1

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

Page 20: Tehran's 1st Android bootcamp - Part1
Page 21: Tehran's 1st Android bootcamp - Part1

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

Page 22: Tehran's 1st Android bootcamp - Part1

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

Page 23: Tehran's 1st Android bootcamp - Part1

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!…

Page 24: Tehran's 1st Android bootcamp - Part1

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...!

Page 25: Tehran's 1st Android bootcamp - Part1

Android Websites

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

Page 26: Tehran's 1st Android bootcamp - Part1
Page 27: Tehran's 1st Android bootcamp - Part1

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

Page 28: Tehran's 1st Android bootcamp - Part1

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

Page 29: Tehran's 1st Android bootcamp - Part1

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

Page 30: Tehran's 1st Android bootcamp - Part1
Page 31: Tehran's 1st Android bootcamp - Part1

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

Page 32: Tehran's 1st Android bootcamp - Part1

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

Page 33: Tehran's 1st Android bootcamp - Part1

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)

Page 34: Tehran's 1st Android bootcamp - Part1

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

Page 35: Tehran's 1st Android bootcamp - Part1

Configure ProjectNew Android application→Next

Page 36: Tehran's 1st Android bootcamp - Part1

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

Page 37: Tehran's 1st Android bootcamp - Part1
Page 38: Tehran's 1st Android bootcamp - Part1

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

Page 39: Tehran's 1st Android bootcamp - Part1

Android Project Important Parts

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

Page 40: Tehran's 1st Android bootcamp - Part1

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• …

Page 41: Tehran's 1st Android bootcamp - Part1

Layout XML CodeXML file specifies the layout of your screen

Page 42: Tehran's 1st Android bootcamp - Part1

Layout XML Code

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

Page 43: Tehran's 1st Android bootcamp - Part1

StringsXML file that contains all the text that your application uses

Page 44: Tehran's 1st Android bootcamp - Part1

Strings

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

Page 45: Tehran's 1st Android bootcamp - Part1

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

Page 46: Tehran's 1st Android bootcamp - Part1

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

Page 47: Tehran's 1st Android bootcamp - Part1

Java Source CodeIs what drives everything

Page 48: Tehran's 1st Android bootcamp - Part1

Java Source Code

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

executable

Page 49: Tehran's 1st Android bootcamp - Part1
Page 50: Tehran's 1st Android bootcamp - Part1

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

Page 51: Tehran's 1st Android bootcamp - Part1

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

Page 52: Tehran's 1st Android bootcamp - Part1

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

Page 53: Tehran's 1st Android bootcamp - Part1

Android Virtual Device (AVD)

Page 54: Tehran's 1st Android bootcamp - Part1

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

Page 55: Tehran's 1st Android bootcamp - Part1

Android Virtual Device (AVD)

Page 56: Tehran's 1st Android bootcamp - Part1

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

Page 57: Tehran's 1st Android bootcamp - Part1

Emulator with -Android 4.2.2 AVD

Page 58: Tehran's 1st Android bootcamp - Part1

Let’s get to work…