Presentation is loading. Please wait.

Presentation is loading. Please wait.

Getting Started with Android Development Rohit Ghatol.

Similar presentations


Presentation on theme: "Getting Started with Android Development Rohit Ghatol."— Presentation transcript:

1 Getting Started with Android Development Rohit Ghatol

2 About Me Rohit Ghatol 1.Architect @QuickOffice 2.Project Mgr @Synerzip 3.Certified Scrum Master 4.Author “Beginning PhoneGap” @ApressBeginning PhoneGap 5.Founder TechNext Pune (Pune Developer Community)TechNext LinkedIn Profile LinkedIn Profile

3 Topics Understanding Android Android Building Blocks Putting Building Blocks Together Latest things in Android World Reference Material 3

4 Understanding Android 4

5 What is Android? Software stack for mobile devices that includes an operating system middleware key applications SDK to develop application 5

6 Android Architecture 6

7 Android OS Names 7

8 8 OS Version NicknameAPI LevelDate 1.1__29 th February 2009 1.5Cupcake330 April 2009 1.6Donut45 September 2009 2.1Eclair726 October 2009 2.2 Froyo820 May 2010 2.3Gingerbread96 th December 2010 3.0Honeycomb1122 nd February 2011 4.XIcecream Sandwich 1419 th October 2011 http://en.wikipedia.org/wiki/Android_version_history

9 Key OS Capabilities 9

10 Android OS Capabilities Phone and OS features – 3G/4G,GPS, Accelerometer, Compass, Camera, SQLite, Wifi, Bluetooth, etc – Near Field Communication – Cloud to Device Messaging (C2DM) – Direct Wifi

11 Android OS Capabilities Notable Features of Android – All Applications are equal – Reuse of Data – Reuse of Functionality

12 All Applications are Equal Replace Home Application Replace Contacts, Dialer Applications Replace SMS, Email Applications Replace Settings Application OEM Customizations (e.g HTC Sense) 12

13 Reuse of Data Default Contact Manager Replaces What happens to data feed into the default Contact Manager? New Contact Manager

14 Reuse of Data Default Contact Manager Replaces New Contact Manager Content Provider But Uses “Replaces” means by default the new app is launched, but old app still exists

15 Reuse of Functionality New Requirement Share with Friends using 1.SMS 2.Email Time to learn SMS API and Email API and code them into my application! More code! Hee hee My Coupons

16 Reuse of Functionality SMS Mail Intention: Want to send Email Here are two applications who can do it for you? My Coupons

17 Reuse of Functionality SMS Mail My Coupons

18 Reuse of Functionality SMS Mail My Coupons

19 Android Environment Setup http://developer.android.com/sdk/in stalling.html 19

20 20 Android SDK Eclipse ADT Android ….. ………………. Android 3.2 Android 4.x Android 2.2 Google API 2.2 SDK Manager AVD Manager Manages Emulator

21 Android Application Dex File Android Manifest Resources MyApp.apk Signed by Self Signed Private Key

22 Identity of Android Application 22 Identity PartExample Package Namecom.sparklytix.android.app.twitter versionCode1 (numeric value 2,3,4,..101,102) Private Key

23 Android Build Cycle 23.java.apk.dex.class javacdx apt AndroidManifest.xml resources AndroidManifest.xml resources

24 How Applications behave? 24

25 25 Dalvik VM Linux Process Linux Kernel Process Dalvik VM Dalvik VM Dalvik VM Uid 1 Uid 2 Uid 3 data com.xyz.email com.abc.skype com.koko.sukudo shared_prefs files databases... UID 1 UID 2 UID 3

26 Android Building Blocks 26

27 ...... Read more - http://developer.android.com/guide/topics/fundamentals.htmlhttp://developer.android.com/guide/topics/fundamentals.html Activity Service Broadcast Receiver Alarm Manager Noti- fication Manager Content Provider Intents Content Resolver Building Blocks Other Components ……

28 First Android Application 28

29 29

30 30

31 31

32 32

33 33

34 34

35 Interacting with Buttons 35

36 Interacting with Button 36

37 Interacting with Buttons 37

38 38

39 Screen Navigation 39

40 40

41 41

42 42

43 43

44 44

45 45

46 startActivityForResult() 46

47 47

48 48

49 49

50 50

51 51

52 Intents 52

53 Understanding Intent IntentsExplicitImplicit Need Class Name Need ACTION CATEGORY DATA

54 Program Launcher <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.sample“ android:versionCode="1“ android:versionName="1.0"> <activity android:name=".HelloWorld" android:label="@string/app_name"> Program launcher shows all the activities which have MAIN Action and LAUNCHER category

55 Conflicts with implicit Intents So what happens two activities have the exact same intent filter and an intent is fired. Simple you choose one application, and you have an option to tell to system that application as the default application hence forth

56 Intent API Reference Intent to launch an Activity Context.startActivity(intent) Context.startActivityForResult(intent) Intent to launch an Service Context.startService(intent) Intent to send a broadcast Context.sendBroadCast(intent)

57 Activity 57

58 Activity Life Cycle

59 Foreground LifeCycle Visible LifeCycle Complete LifeCycle Activity Life Cycle (made easy) onCreate onDestroy onStart onStop onResume onPause

60 What to do in what method? onCreate onDestroy onStart onStop onResume onPause

61 Services 61

62 Calling Service Activity Service void onStartCommand (Intent intent,…){ } startService(intent) Fire & Forget

63 Calling Service Activity Service 1.bindService(intent) 2.….. 3.service.foo() 4.int result=service.bar() void foo(){ } int bar(){ } RPC Style

64 64

65 Broadcast Receivers 65

66 Broadcast Receivers App 1 Android OS App 2 Your App Custom Event 1 Custom Event 2 Battery Low Roaming Boot Network Change Interested in any of these Events.

67 Broadcast Receivers No Life Cycle Methods Only Call back method 10 second limit before ANR Need not register with Android Manifest Can be registered at Runtime

68 Use case Email Application 68

69 Mail Application – Use Case

70 Building Blocks of Android ActivityService Broadcast Receiver Content Provider/ SQL ite Database Mail Sync Data Store (Email List) Phone Boots Communication is using Intents

71 Activity Mail Sync Service Phone Boots Broadcast R Data Store (Email List) Database Events.. Alarm M.. Notifi. M.. Phone Boots

72 Mail Sync Service Phone Boots Broadcast R Data Store (Email List) Database Events..Alarm M.. Phone Boots Mail Sync (5 mins) Activity Notifi. M..

73 Mail Sync Service Phone Boots Broadcast R Data Store (Email List) Database Events..Alarm M.. Phone Boots Mail Sync (5 mins) Activity Notifi. M.. Broadcast R

74 Mail Sync Service Phone Boots Broadcast R Data Store (Email List) Database Events..Alarm M.. Phone Boots Mail Sync (5 mins) Activity Notifi. M.. Broadcast R

75 Mail Sync Service Phone Boots Broadcast R Data Store (Email List) Database Events..Alarm M.. Phone Boots Mail Sync (5 mins) Activity Notifi. M.. starts

76 Mail Sync Service Phone Boots Broadcast R Data Store (Email List) Database Events..Alarm M.. Phone Boots Mail Sync (5 mins) Activity Notifi. M.. Completes

77 Mail Sync Service Phone Boots Broadcast R Data Store (Email List) Database Events..Alarm M.. Phone Boots Mail Sync (5 mins) Activity Notifi. M.. Stores

78 Mail Sync Service Phone Boots Broadcast R Data Store (Email List) Database Events..Alarm M.. Phone Boots Mail Sync (5 mins) Activity Notifi. M.. Stores Mail Notification

79 Mail Sync Service Phone Boots Broadcast R Data Store (Email List) Database Events..Alarm M.. Phone Boots Mail Sync (5 mins) Activity Notifi. M.. Mail Notification

80 Mail Sync Service Phone Boots Broadcast R Events..Alarm M.. Phone Boots Mail Sync (5 mins) Activity Notifi. M.. Mail Notification Data Store (Email List) Database

81 Mail Sync Service Phone Boots Broadcast R Data Store (Email List) Database Events..Alarm M.. Phone Boots Mail Sync (5 mins) Activity Notifi. M.. Mail Notification

82 Twitter App All these Building blocks are covered in more detail on 3 rd November at 3:40 p.m in “Building Twitter App for Android”Building Twitter App for Android 82

83 Q & A 83

84 More about Me Twitter - http://twitter.com/#!/rohitghatolhttp://twitter.com/#!/rohitghatol TechGig - http://www.techgig.com/rohitghatolhttp://www.techgig.com/rohitghatol LinkedIn - http://www.linkedin.com/in/rohitghatol http://www.linkedin.com/in/rohitghatol Presentations - www.slideshare.net/rohitsghatol/ www.slideshare.net/rohitsghatol/ YouTube Tutorials - http://www.youtube.com/user/rohitssghatol http://www.youtube.com/user/rohitssghatol


Download ppt "Getting Started with Android Development Rohit Ghatol."

Similar presentations


Ads by Google