SlideShare a Scribd company logo
1 of 50
Android Workshop UCD, 10th April 2010 #UCDDD
Objectives Android 101 Overview of the platform Some market information Development of Android based app Partial Walkthrough Two components: Server side Facebook, foursquare Mobile client Talks to server (or not!)
Android 101
Overview Background/history Android concepts Comments on APIs Comment on market
Background/History Android Inc developed vision for platform Acquired in 2005 by Google Launched November 2007 In conjunction with Open Handset Alliance Number of variants since 1.1, 1.5, 1.6, 2.0, 2.1 Google working with many handset manufacturers and operators HTC, Sony Ericsson, Motorola, LG
What is Android? Mobile Operating system Linux kernel v2.6.x Architecture for developing mobile applications Much work on developing concepts Mobile OS differs from desktop OS Large set of APIs Much functionality provided Dalvik VM Native Interface available late 09
Differences from THE OTHER ONE More open in general Although key parts kept closed No constraints on store… Except that they pay store is not available in Ire Technical Multitasking Until last Thurs Bluetooth Issues with multi-touch until recently
Perspective of App Developer Rich Java based framework Closer to Java SE than Java ME Good separation of UI and functionality Rapidly evolving platform Too fast in 09 Platform with rapidly growing user base Rapidly increasing number of apps Do not have Apple toll bridge Anything can be published
What does Android app look like Set of Java classes External jars need to be packaged Manifest describing application XML based descriptors of UI Typically Packaged into apk file For distribution in market and more generally Can be signed
Components Application comprised of different components Android defines 4 types of components Activities Services Broadcast receivers Content providers Somehow notion of main not always necessary When writing a service, for example
Activity Idea is somehow single action user is engaged in Part of a task Examples Choosing people from list of contact Entering some text Navigating around a map Application can comprise of one or more activities Typically more One activity initiates next activity
Activity Activities linked to views (somewhat) Android facilitates views which are decoupled Defined in XML and bundled with package Activity generally renders a specific view View designed for specific activity
Services Like daemons Run for some period of time providing service for activities Fetch network data or perform calculation Music playback Service runs in main thread Can initiate other threads if needed Can bind to running service
Broadcast receivers and Content Providers Broadcast receivers Listen for broadcast messages Time change, language change Do not have UI, but may engage with user Notification mechanism Can start activty Content Provider Enables an application to share its own data with another application
Definition of the application – manifest.xml Every application has file defining components Lists activities, services, etc Example: <?xml version="1.0" encoding="utf-8"?> <manifest . . . >     <application . . . >         <activity android:name="com.example.project.FreneticActivity" android:icon="@drawable/small_pic.png" android:label="@string/freneticLabel"                    . . .  >         </activity>         . . .     </application> </manifest>
Intents More complex (subtle?) notion Application can be invoked with different intents Eg from windows – file dragged onto app Behaviour of application depends on intent ACTION_CALL, ACTION_MAIN, ACTION_SYNC ACTION_MAIN most commonly used Manifest indicates which activity initiated on ACTION_MAIN
Tasks Activities from multiple applications can be combined into tasks Applications can be aware of activities extant in other applications Can invoke them with certain intent Typically such activities in a ‘suite’ A stack which retains user’s sequence of activities This is how user perceives application Note: application now ambiguous/overloaded
So what about processes? Lots of flexibility Activities, components, receivers and providers can be in single process Can be split quite arbitrarily over different processes Defined in manifest All process run as uid of application All components run in a single main thread of application Blocking! Need to ensure longer term tasks run in new thread
Lifecycles - Activity Three states for activity Active or running Visible in foreground on screen Paused Still visible, but not main focus When notification window open Stopped Not visible, retaining state More likely to be terminated
Activity Lifecycle – state changes Transitions void onCreate(Bundle savedInstanceState)  void onStart()  void onRestart()  void onResume()  void onPause()  void onStop()  void onDestroy()
Processes and lifecycles Android tends to use available resources Keeps things alive when in doubt Processes have one of 5 states: Foreground, visible, service, background, empty Process’s state may be linked to another process Service tied to foreground process When resources run low, lowest priority processes removed
Android APIs Mix of APIs from different sources Apache http libs, standard java se libs, xml, jsonlibs Android-specific APIs Phone APIs Telephony, contacts, location, bluetooth/wifi Interface APIs Gesture, speech Graphics Widgets, webkit, opengl
Android in the marketplace Android activity intense right now Over 50 devices in production or development Phones, tablets, e-readers, etc Sales of 60k units per day Adds up to 22m per annum iPhone sold 25m in 09 App store rocketing Apps doubled in Q110
Building an Android App
Building an Android App Overview What the (intended) app looked like Backend How this was realized Mobile client How this was implemented
Building an Android App Overview
Planned app… Integrate information from Facebook and Foursquare Facebook intended to provide rich network of relationships Foursquare to provide location aspects Idea Application targetted at group of people on weekend away Hen/Stag party obvious example
Intended workflow On the web… User goes to (stand alone) website Selects friends going on weekend away Facebook info Maps Facebook friends to Foursquare friends Somehow (?) Party going on tour stored in DB Both FB and FS uids stored …and over to mobile…
Intended workflow Users download mobile app Used for duration of visit App can be used to Check in Check in on FS View group history Upload photos Make comments for group Provide for richer group experience
Building an Android app Backend
Issues with development of backend Used Django framework Rapid development Used facebook and foursquare libraries for development Python/django libraries exist for both Multiple python facebook libraries exist Chose FB connect as main approach to talk to FB Django supports Oauthauthentiation based on this
Issues with development of backend FB Connect libraries were a little limiting Very premised on notion that friends (of interest) are only those subscribed to site Common way to use FB Connect I wanted to extract all friends of given user Had to use some of the more conventional FB capabilities More focused on apps in FB Raised question of whether app should be housed in FB in first place
Issues with development of backend Significant issue with mapping of FB users to FS users Although my friends on FS do have FB links (I don’t) Can iterate through friends lists to find matches Email remainder to sign up for FS Did not get this complete
Issues with development of backend Foursquare API is still basic Underestimated maturity of this as platform Thought I could get friends history To show how people moved during the weekend FS API only allows access to last place friend was observed My backend needed to keep check ins also To show fuller picture of weekend Python FS API v simple to use
Issues with development of backend Got basic capabilities working Authentication via FB Select list of FB friends going on weekend Get FS id of those who have simple mapping of FB to FS id In their FS profile Did not get important parts working Mobile API Photo support Poor design decisions when constructing DB
Building an Android App Mobile client
Android development Short overview of tools Very important Describe a little about how a simple Android app works Issues I had with FB, FS integration
Android – getting up and running Android SDK Base tools common to all versions of platform Emulator framework cmd line tools to deploy apps on device IDE – Eclipse preferred ADT plug in Provides Android libraries, hooks into emulator, deployment, etc Android Platform versions Install in SDK
Basic tools Main tool adb – flexible tool to enable host to talk to device Used to install package on device Put file on device Shell into device Show device logs – these include application error traces Other tools ddms – tool for connecting to on device process to debug  apkbuilder – tool to generate android package (apk) Apk files used in market Can also be used to sign Tools for db management, libraries, etc
Eclipse plug-in ADT is Eclipse plug-in for Android development Can be installed directly from online resource Features include: Knowledge of Android libraries Suggestions for completion of names/methods Reasonable support for layout of views Drag and drop elements onto canvas Good support for manipulation of manifest Debugging support
External jars Possible to add external jars to application Often v useful for talking to network services Eg foursquare in this case Issue with jar for shipping app Jar must be included in package Unless it is known (how?) jar is available on device Addition of external jars straightforward in Eclipse
A basic activity Class MyActivity extends Activity implements xxxListenersxxx { private EditTextusernameText = null ; private EditTextpasswordText = null ; Private Button button = null ;  @Override     public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);         button = (Button)findViewById(R.id.Button01); button.setOnClickListener(this);     }  public void onClick(View v) { …. } }
Basic activity: reacting to event  public void onClick(View v) {       // do something when the button is clicked     	// put the values in username and password into some     	// strings         edittext1 = (EditText)findViewById(R.id.EditText01);         edittext2 = (EditText)findViewById(R.id.EditText02);     	String username = edittext1.getText().toString();      	String password = edittext2.getText().toString(); }
Moving on to next activity Approach is straightforward Create an intent and tell Android Some code: Intent myIntent = new Intent(); myIntent.setClassName("com.android.samples", "com.android.samples.Animation1"); myIntent.putExtra("com.android.samples.SpecialValue", "Hello, Joe!"); // key/value pair, where key needs current package prefix. StartActivity(myIntent);  Platform does manifest lookup to determine what to do
When new activity instigated… Can receive information from previous activity Transfer mechanism somewhat invisible Activity class has getIntent() method Used to determine how activity was called Some code: @Override  public void onCreate(Bundle icicle) {  super.onCreate(icicle);  Integer category = this.getIntent().getIntExtra("category",  -1);
More generally…moving data around Simple data can be transferred between activities using Bundles Android.app.Application can be extended Incorporating global application state Public/static fields/methods A bit clunky Persistent storage: Application preferences, files, sqlite DB
Issues with maps and keys MapView API requires keys for use Keys linked to developer and to application Unique key for each application For development phase… Android generates certificate for signing application automatically Not tied to certificate authority Submit hash of this certificate to obtain working key For release… Generate public/private key and use these to create certificate
Progress Did not really get through facebook and foursquare functions on device Foursquare api looks simple, easy to use on android Library exists for this Facebook connect for android project is work in progress Did not look at this
The 49thparallell Some upcoming activities UCD/EPITA Android Hackathon 14-16 April Startup Weekend – NDRC 7-9 May Opportunities day Invited Talk: ‘Mobile @ Google’ Dave Burke, Engineering Manager, Google 14 May
Q&A

More Related Content

What's hot

OSCON Titanium Tutorial
OSCON Titanium TutorialOSCON Titanium Tutorial
OSCON Titanium TutorialKevin Whinnery
 
Hybrid Application Development documentation report (MCA Project)
Hybrid Application Development documentation report (MCA Project)Hybrid Application Development documentation report (MCA Project)
Hybrid Application Development documentation report (MCA Project)vetri pandi
 
Html5 investigation
Html5 investigationHtml5 investigation
Html5 investigationoppokui
 
Top 11 Front-End Web Development Tools To Consider in 2020
 Top 11 Front-End Web Development Tools To Consider in 2020 Top 11 Front-End Web Development Tools To Consider in 2020
Top 11 Front-End Web Development Tools To Consider in 2020Katy Slemon
 
Getting Acquainted with PhoneGap
Getting Acquainted with PhoneGapGetting Acquainted with PhoneGap
Getting Acquainted with PhoneGapJoseph Labrecque
 
Why does .net maui deserve your attention if you’re planning to use xamarin
Why does .net maui deserve your attention if you’re planning to use xamarin  Why does .net maui deserve your attention if you’re planning to use xamarin
Why does .net maui deserve your attention if you’re planning to use xamarin Moon Technolabs Pvt. Ltd.
 
An overview of the architecture of electron.js
An overview of the architecture of electron.jsAn overview of the architecture of electron.js
An overview of the architecture of electron.jsMoon Technolabs Pvt. Ltd.
 
Christopher Allen’s Presentation at eComm 2009
Christopher Allen’s Presentation at eComm 2009Christopher Allen’s Presentation at eComm 2009
Christopher Allen’s Presentation at eComm 2009eCommConf
 
White paper native, web or hybrid mobile app development
White paper  native, web or hybrid mobile app developmentWhite paper  native, web or hybrid mobile app development
White paper native, web or hybrid mobile app developmentIBM Software India
 
Java Swing vs. Android App
Java Swing vs. Android AppJava Swing vs. Android App
Java Swing vs. Android AppJohnny Hujol
 
Chapter 01
Chapter 01Chapter 01
Chapter 01llmeade
 
Basic of Android App Development
Basic of Android App DevelopmentBasic of Android App Development
Basic of Android App DevelopmentAbhijeet Gupta
 
An end-to-end experience of Windows Phone 7 development (Part 2)
An end-to-end experience of Windows Phone 7 development (Part 2)An end-to-end experience of Windows Phone 7 development (Part 2)
An end-to-end experience of Windows Phone 7 development (Part 2)rudigrobler
 
Introduction to oop (object oriented programming)
Introduction to oop (object oriented programming)Introduction to oop (object oriented programming)
Introduction to oop (object oriented programming)Mark John Lado, MIT
 
Rich Internet Applications (RIA)
Rich Internet Applications (RIA)Rich Internet Applications (RIA)
Rich Internet Applications (RIA)guest3214e8
 
Top mobile app development frameworks to consider in 2021
Top mobile app development frameworks to consider in 2021Top mobile app development frameworks to consider in 2021
Top mobile app development frameworks to consider in 2021Katy Slemon
 

What's hot (19)

OSCON Titanium Tutorial
OSCON Titanium TutorialOSCON Titanium Tutorial
OSCON Titanium Tutorial
 
Hybrid Application Development documentation report (MCA Project)
Hybrid Application Development documentation report (MCA Project)Hybrid Application Development documentation report (MCA Project)
Hybrid Application Development documentation report (MCA Project)
 
Html5 investigation
Html5 investigationHtml5 investigation
Html5 investigation
 
Top 11 Front-End Web Development Tools To Consider in 2020
 Top 11 Front-End Web Development Tools To Consider in 2020 Top 11 Front-End Web Development Tools To Consider in 2020
Top 11 Front-End Web Development Tools To Consider in 2020
 
Getting Acquainted with PhoneGap
Getting Acquainted with PhoneGapGetting Acquainted with PhoneGap
Getting Acquainted with PhoneGap
 
Why does .net maui deserve your attention if you’re planning to use xamarin
Why does .net maui deserve your attention if you’re planning to use xamarin  Why does .net maui deserve your attention if you’re planning to use xamarin
Why does .net maui deserve your attention if you’re planning to use xamarin
 
An overview of the architecture of electron.js
An overview of the architecture of electron.jsAn overview of the architecture of electron.js
An overview of the architecture of electron.js
 
Christopher Allen’s Presentation at eComm 2009
Christopher Allen’s Presentation at eComm 2009Christopher Allen’s Presentation at eComm 2009
Christopher Allen’s Presentation at eComm 2009
 
Windows 7 mobile
Windows 7 mobileWindows 7 mobile
Windows 7 mobile
 
White paper native, web or hybrid mobile app development
White paper  native, web or hybrid mobile app developmentWhite paper  native, web or hybrid mobile app development
White paper native, web or hybrid mobile app development
 
Java Swing vs. Android App
Java Swing vs. Android AppJava Swing vs. Android App
Java Swing vs. Android App
 
Chapter 01
Chapter 01Chapter 01
Chapter 01
 
Basic of Android App Development
Basic of Android App DevelopmentBasic of Android App Development
Basic of Android App Development
 
An end-to-end experience of Windows Phone 7 development (Part 2)
An end-to-end experience of Windows Phone 7 development (Part 2)An end-to-end experience of Windows Phone 7 development (Part 2)
An end-to-end experience of Windows Phone 7 development (Part 2)
 
Introduction to oop (object oriented programming)
Introduction to oop (object oriented programming)Introduction to oop (object oriented programming)
Introduction to oop (object oriented programming)
 
Mobile development
Mobile development Mobile development
Mobile development
 
Rich Internet Applications (RIA)
Rich Internet Applications (RIA)Rich Internet Applications (RIA)
Rich Internet Applications (RIA)
 
Mobile Apps Develpment - A Comparison
Mobile Apps Develpment - A ComparisonMobile Apps Develpment - A Comparison
Mobile Apps Develpment - A Comparison
 
Top mobile app development frameworks to consider in 2021
Top mobile app development frameworks to consider in 2021Top mobile app development frameworks to consider in 2021
Top mobile app development frameworks to consider in 2021
 

Viewers also liked

Android 101 - Manuel Vicente Vivo
Android 101 - Manuel Vicente VivoAndroid 101 - Manuel Vicente Vivo
Android 101 - Manuel Vicente VivoManuel Vicente Vivo
 
Android 101 - Amrou & Chiheb - IGC
Android 101 - Amrou & Chiheb - IGCAndroid 101 - Amrou & Chiheb - IGC
Android 101 - Amrou & Chiheb - IGCAmrou Bouaziz
 
Android 101 Writing And Publishing Android Applications
Android 101  Writing And Publishing Android ApplicationsAndroid 101  Writing And Publishing Android Applications
Android 101 Writing And Publishing Android ApplicationsGitesh Khodiyar
 
Android workshop - 02. Glass development 101
Android workshop - 02. Glass development 101Android workshop - 02. Glass development 101
Android workshop - 02. Glass development 101Johnny Sung
 
Android Workshop 2013
Android Workshop 2013Android Workshop 2013
Android Workshop 2013Junda Ong
 
Android 101 Session @thejunction32
Android 101 Session @thejunction32Android 101 Session @thejunction32
Android 101 Session @thejunction32Eden Shochat
 
Internet of things
Internet of thingsInternet of things
Internet of thingsOKAN AYDIN
 

Viewers also liked (10)

Android 101: Do Plano ao Play
Android 101: Do Plano ao PlayAndroid 101: Do Plano ao Play
Android 101: Do Plano ao Play
 
Android 101 - Manuel Vicente Vivo
Android 101 - Manuel Vicente VivoAndroid 101 - Manuel Vicente Vivo
Android 101 - Manuel Vicente Vivo
 
Android 101 - Amrou & Chiheb - IGC
Android 101 - Amrou & Chiheb - IGCAndroid 101 - Amrou & Chiheb - IGC
Android 101 - Amrou & Chiheb - IGC
 
Android 101
Android 101Android 101
Android 101
 
Android 101 Writing And Publishing Android Applications
Android 101  Writing And Publishing Android ApplicationsAndroid 101  Writing And Publishing Android Applications
Android 101 Writing And Publishing Android Applications
 
Android workshop - 02. Glass development 101
Android workshop - 02. Glass development 101Android workshop - 02. Glass development 101
Android workshop - 02. Glass development 101
 
Android Workshop 2013
Android Workshop 2013Android Workshop 2013
Android Workshop 2013
 
Android 101 Session @thejunction32
Android 101 Session @thejunction32Android 101 Session @thejunction32
Android 101 Session @thejunction32
 
Android 101 workshop
Android 101 workshopAndroid 101 workshop
Android 101 workshop
 
Internet of things
Internet of thingsInternet of things
Internet of things
 

Similar to Android Workshop Mobile App Development

First Steps with Android - An Exciting Introduction
First Steps with Android - An Exciting IntroductionFirst Steps with Android - An Exciting Introduction
First Steps with Android - An Exciting IntroductionCesar Augusto Nogueira
 
Nativa Android Applications development
Nativa Android Applications developmentNativa Android Applications development
Nativa Android Applications developmentAlfredo Morresi
 
Windows Phone 7.5 Mango - What's New
Windows Phone 7.5 Mango - What's NewWindows Phone 7.5 Mango - What's New
Windows Phone 7.5 Mango - What's NewSascha Corti
 
Introduction to Android Development Part 1
Introduction to Android Development Part 1Introduction to Android Development Part 1
Introduction to Android Development Part 1Kainda Kiniel Daka
 
Sogeti - Android tech track presentation - 24 february 2011
Sogeti - Android tech track presentation - 24 february 2011Sogeti - Android tech track presentation - 24 february 2011
Sogeti - Android tech track presentation - 24 february 2011Kenneth van Rumste
 
Android overview
Android overviewAndroid overview
Android overviewHas Taiar
 
Android In A Nutshell
Android In A NutshellAndroid In A Nutshell
Android In A NutshellTed Chien
 
JQuery Mobile vs Appcelerator Titanium vs Sencha Touch
JQuery Mobile vs Appcelerator Titanium vs Sencha TouchJQuery Mobile vs Appcelerator Titanium vs Sencha Touch
JQuery Mobile vs Appcelerator Titanium vs Sencha TouchSteve Drucker
 
Mobile app development using PhoneGap - A comprehensive walkthrough - Touch T...
Mobile app development using PhoneGap - A comprehensive walkthrough - Touch T...Mobile app development using PhoneGap - A comprehensive walkthrough - Touch T...
Mobile app development using PhoneGap - A comprehensive walkthrough - Touch T...RIA RUI Society
 
Android terminologies
Android terminologiesAndroid terminologies
Android terminologiesjerry vasoya
 
Intro To Android App Development
Intro To Android App DevelopmentIntro To Android App Development
Intro To Android App DevelopmentMike Kvintus
 
Developing Mobile Applications using Flex 4.5
Developing Mobile Applications using Flex 4.5Developing Mobile Applications using Flex 4.5
Developing Mobile Applications using Flex 4.5Chaithanya Yambari
 
Building Cross-Platform Mobile Apps
Building Cross-Platform Mobile AppsBuilding Cross-Platform Mobile Apps
Building Cross-Platform Mobile AppsTroy Miles
 
5 beginner android application development foundation
5 beginner android application development foundation5 beginner android application development foundation
5 beginner android application development foundationCbitss Technologies
 
Android app fundamentals
Android app fundamentalsAndroid app fundamentals
Android app fundamentalsAmr Salman
 

Similar to Android Workshop Mobile App Development (20)

First Steps with Android - An Exciting Introduction
First Steps with Android - An Exciting IntroductionFirst Steps with Android - An Exciting Introduction
First Steps with Android - An Exciting Introduction
 
Nativa Android Applications development
Nativa Android Applications developmentNativa Android Applications development
Nativa Android Applications development
 
Windows Phone 7.5 Mango - What's New
Windows Phone 7.5 Mango - What's NewWindows Phone 7.5 Mango - What's New
Windows Phone 7.5 Mango - What's New
 
Android platform
Android platform Android platform
Android platform
 
Introduction to Android Development Part 1
Introduction to Android Development Part 1Introduction to Android Development Part 1
Introduction to Android Development Part 1
 
Sogeti - Android tech track presentation - 24 february 2011
Sogeti - Android tech track presentation - 24 february 2011Sogeti - Android tech track presentation - 24 february 2011
Sogeti - Android tech track presentation - 24 february 2011
 
Android overview
Android overviewAndroid overview
Android overview
 
Android In A Nutshell
Android In A NutshellAndroid In A Nutshell
Android In A Nutshell
 
Android Introduction by Kajal
Android Introduction by KajalAndroid Introduction by Kajal
Android Introduction by Kajal
 
JQuery Mobile vs Appcelerator Titanium vs Sencha Touch
JQuery Mobile vs Appcelerator Titanium vs Sencha TouchJQuery Mobile vs Appcelerator Titanium vs Sencha Touch
JQuery Mobile vs Appcelerator Titanium vs Sencha Touch
 
Mobile app development using PhoneGap - A comprehensive walkthrough - Touch T...
Mobile app development using PhoneGap - A comprehensive walkthrough - Touch T...Mobile app development using PhoneGap - A comprehensive walkthrough - Touch T...
Mobile app development using PhoneGap - A comprehensive walkthrough - Touch T...
 
PPT Companion to Android
PPT Companion to AndroidPPT Companion to Android
PPT Companion to Android
 
Android Basic Concept
Android Basic Concept Android Basic Concept
Android Basic Concept
 
Android terminologies
Android terminologiesAndroid terminologies
Android terminologies
 
Intro To Android App Development
Intro To Android App DevelopmentIntro To Android App Development
Intro To Android App Development
 
Developing Mobile Applications using Flex 4.5
Developing Mobile Applications using Flex 4.5Developing Mobile Applications using Flex 4.5
Developing Mobile Applications using Flex 4.5
 
Building Cross-Platform Mobile Apps
Building Cross-Platform Mobile AppsBuilding Cross-Platform Mobile Apps
Building Cross-Platform Mobile Apps
 
5 beginner android application development foundation
5 beginner android application development foundation5 beginner android application development foundation
5 beginner android application development foundation
 
Android app fundamentals
Android app fundamentalsAndroid app fundamentals
Android app fundamentals
 
Android dev o_auth
Android dev o_authAndroid dev o_auth
Android dev o_auth
 

More from Sean Murphy

More from Sean Murphy (8)

Hadoop pig
Hadoop pigHadoop pig
Hadoop pig
 
Demonstration
DemonstrationDemonstration
Demonstration
 
Overview of no sql
Overview of no sqlOverview of no sql
Overview of no sql
 
Cassandra overview
Cassandra overviewCassandra overview
Cassandra overview
 
No sql course introduction
No sql course   introductionNo sql course   introduction
No sql course introduction
 
Rss talk
Rss talkRss talk
Rss talk
 
Rss announcements
Rss announcementsRss announcements
Rss announcements
 
Rocco pres-v1
Rocco pres-v1Rocco pres-v1
Rocco pres-v1
 

Android Workshop Mobile App Development

  • 1. Android Workshop UCD, 10th April 2010 #UCDDD
  • 2. Objectives Android 101 Overview of the platform Some market information Development of Android based app Partial Walkthrough Two components: Server side Facebook, foursquare Mobile client Talks to server (or not!)
  • 4. Overview Background/history Android concepts Comments on APIs Comment on market
  • 5. Background/History Android Inc developed vision for platform Acquired in 2005 by Google Launched November 2007 In conjunction with Open Handset Alliance Number of variants since 1.1, 1.5, 1.6, 2.0, 2.1 Google working with many handset manufacturers and operators HTC, Sony Ericsson, Motorola, LG
  • 6. What is Android? Mobile Operating system Linux kernel v2.6.x Architecture for developing mobile applications Much work on developing concepts Mobile OS differs from desktop OS Large set of APIs Much functionality provided Dalvik VM Native Interface available late 09
  • 7. Differences from THE OTHER ONE More open in general Although key parts kept closed No constraints on store… Except that they pay store is not available in Ire Technical Multitasking Until last Thurs Bluetooth Issues with multi-touch until recently
  • 8. Perspective of App Developer Rich Java based framework Closer to Java SE than Java ME Good separation of UI and functionality Rapidly evolving platform Too fast in 09 Platform with rapidly growing user base Rapidly increasing number of apps Do not have Apple toll bridge Anything can be published
  • 9. What does Android app look like Set of Java classes External jars need to be packaged Manifest describing application XML based descriptors of UI Typically Packaged into apk file For distribution in market and more generally Can be signed
  • 10. Components Application comprised of different components Android defines 4 types of components Activities Services Broadcast receivers Content providers Somehow notion of main not always necessary When writing a service, for example
  • 11. Activity Idea is somehow single action user is engaged in Part of a task Examples Choosing people from list of contact Entering some text Navigating around a map Application can comprise of one or more activities Typically more One activity initiates next activity
  • 12. Activity Activities linked to views (somewhat) Android facilitates views which are decoupled Defined in XML and bundled with package Activity generally renders a specific view View designed for specific activity
  • 13. Services Like daemons Run for some period of time providing service for activities Fetch network data or perform calculation Music playback Service runs in main thread Can initiate other threads if needed Can bind to running service
  • 14. Broadcast receivers and Content Providers Broadcast receivers Listen for broadcast messages Time change, language change Do not have UI, but may engage with user Notification mechanism Can start activty Content Provider Enables an application to share its own data with another application
  • 15. Definition of the application – manifest.xml Every application has file defining components Lists activities, services, etc Example: <?xml version="1.0" encoding="utf-8"?> <manifest . . . > <application . . . > <activity android:name="com.example.project.FreneticActivity" android:icon="@drawable/small_pic.png" android:label="@string/freneticLabel" . . . > </activity> . . . </application> </manifest>
  • 16. Intents More complex (subtle?) notion Application can be invoked with different intents Eg from windows – file dragged onto app Behaviour of application depends on intent ACTION_CALL, ACTION_MAIN, ACTION_SYNC ACTION_MAIN most commonly used Manifest indicates which activity initiated on ACTION_MAIN
  • 17. Tasks Activities from multiple applications can be combined into tasks Applications can be aware of activities extant in other applications Can invoke them with certain intent Typically such activities in a ‘suite’ A stack which retains user’s sequence of activities This is how user perceives application Note: application now ambiguous/overloaded
  • 18. So what about processes? Lots of flexibility Activities, components, receivers and providers can be in single process Can be split quite arbitrarily over different processes Defined in manifest All process run as uid of application All components run in a single main thread of application Blocking! Need to ensure longer term tasks run in new thread
  • 19. Lifecycles - Activity Three states for activity Active or running Visible in foreground on screen Paused Still visible, but not main focus When notification window open Stopped Not visible, retaining state More likely to be terminated
  • 20. Activity Lifecycle – state changes Transitions void onCreate(Bundle savedInstanceState) void onStart() void onRestart() void onResume() void onPause() void onStop() void onDestroy()
  • 21. Processes and lifecycles Android tends to use available resources Keeps things alive when in doubt Processes have one of 5 states: Foreground, visible, service, background, empty Process’s state may be linked to another process Service tied to foreground process When resources run low, lowest priority processes removed
  • 22. Android APIs Mix of APIs from different sources Apache http libs, standard java se libs, xml, jsonlibs Android-specific APIs Phone APIs Telephony, contacts, location, bluetooth/wifi Interface APIs Gesture, speech Graphics Widgets, webkit, opengl
  • 23. Android in the marketplace Android activity intense right now Over 50 devices in production or development Phones, tablets, e-readers, etc Sales of 60k units per day Adds up to 22m per annum iPhone sold 25m in 09 App store rocketing Apps doubled in Q110
  • 25. Building an Android App Overview What the (intended) app looked like Backend How this was realized Mobile client How this was implemented
  • 26. Building an Android App Overview
  • 27. Planned app… Integrate information from Facebook and Foursquare Facebook intended to provide rich network of relationships Foursquare to provide location aspects Idea Application targetted at group of people on weekend away Hen/Stag party obvious example
  • 28. Intended workflow On the web… User goes to (stand alone) website Selects friends going on weekend away Facebook info Maps Facebook friends to Foursquare friends Somehow (?) Party going on tour stored in DB Both FB and FS uids stored …and over to mobile…
  • 29. Intended workflow Users download mobile app Used for duration of visit App can be used to Check in Check in on FS View group history Upload photos Make comments for group Provide for richer group experience
  • 30. Building an Android app Backend
  • 31. Issues with development of backend Used Django framework Rapid development Used facebook and foursquare libraries for development Python/django libraries exist for both Multiple python facebook libraries exist Chose FB connect as main approach to talk to FB Django supports Oauthauthentiation based on this
  • 32. Issues with development of backend FB Connect libraries were a little limiting Very premised on notion that friends (of interest) are only those subscribed to site Common way to use FB Connect I wanted to extract all friends of given user Had to use some of the more conventional FB capabilities More focused on apps in FB Raised question of whether app should be housed in FB in first place
  • 33. Issues with development of backend Significant issue with mapping of FB users to FS users Although my friends on FS do have FB links (I don’t) Can iterate through friends lists to find matches Email remainder to sign up for FS Did not get this complete
  • 34. Issues with development of backend Foursquare API is still basic Underestimated maturity of this as platform Thought I could get friends history To show how people moved during the weekend FS API only allows access to last place friend was observed My backend needed to keep check ins also To show fuller picture of weekend Python FS API v simple to use
  • 35. Issues with development of backend Got basic capabilities working Authentication via FB Select list of FB friends going on weekend Get FS id of those who have simple mapping of FB to FS id In their FS profile Did not get important parts working Mobile API Photo support Poor design decisions when constructing DB
  • 36. Building an Android App Mobile client
  • 37. Android development Short overview of tools Very important Describe a little about how a simple Android app works Issues I had with FB, FS integration
  • 38. Android – getting up and running Android SDK Base tools common to all versions of platform Emulator framework cmd line tools to deploy apps on device IDE – Eclipse preferred ADT plug in Provides Android libraries, hooks into emulator, deployment, etc Android Platform versions Install in SDK
  • 39. Basic tools Main tool adb – flexible tool to enable host to talk to device Used to install package on device Put file on device Shell into device Show device logs – these include application error traces Other tools ddms – tool for connecting to on device process to debug apkbuilder – tool to generate android package (apk) Apk files used in market Can also be used to sign Tools for db management, libraries, etc
  • 40. Eclipse plug-in ADT is Eclipse plug-in for Android development Can be installed directly from online resource Features include: Knowledge of Android libraries Suggestions for completion of names/methods Reasonable support for layout of views Drag and drop elements onto canvas Good support for manipulation of manifest Debugging support
  • 41. External jars Possible to add external jars to application Often v useful for talking to network services Eg foursquare in this case Issue with jar for shipping app Jar must be included in package Unless it is known (how?) jar is available on device Addition of external jars straightforward in Eclipse
  • 42. A basic activity Class MyActivity extends Activity implements xxxListenersxxx { private EditTextusernameText = null ; private EditTextpasswordText = null ; Private Button button = null ; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); button = (Button)findViewById(R.id.Button01); button.setOnClickListener(this); } public void onClick(View v) { …. } }
  • 43. Basic activity: reacting to event public void onClick(View v) { // do something when the button is clicked // put the values in username and password into some // strings edittext1 = (EditText)findViewById(R.id.EditText01); edittext2 = (EditText)findViewById(R.id.EditText02); String username = edittext1.getText().toString(); String password = edittext2.getText().toString(); }
  • 44. Moving on to next activity Approach is straightforward Create an intent and tell Android Some code: Intent myIntent = new Intent(); myIntent.setClassName("com.android.samples", "com.android.samples.Animation1"); myIntent.putExtra("com.android.samples.SpecialValue", "Hello, Joe!"); // key/value pair, where key needs current package prefix. StartActivity(myIntent); Platform does manifest lookup to determine what to do
  • 45. When new activity instigated… Can receive information from previous activity Transfer mechanism somewhat invisible Activity class has getIntent() method Used to determine how activity was called Some code: @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); Integer category = this.getIntent().getIntExtra("category", -1);
  • 46. More generally…moving data around Simple data can be transferred between activities using Bundles Android.app.Application can be extended Incorporating global application state Public/static fields/methods A bit clunky Persistent storage: Application preferences, files, sqlite DB
  • 47. Issues with maps and keys MapView API requires keys for use Keys linked to developer and to application Unique key for each application For development phase… Android generates certificate for signing application automatically Not tied to certificate authority Submit hash of this certificate to obtain working key For release… Generate public/private key and use these to create certificate
  • 48. Progress Did not really get through facebook and foursquare functions on device Foursquare api looks simple, easy to use on android Library exists for this Facebook connect for android project is work in progress Did not look at this
  • 49. The 49thparallell Some upcoming activities UCD/EPITA Android Hackathon 14-16 April Startup Weekend – NDRC 7-9 May Opportunities day Invited Talk: ‘Mobile @ Google’ Dave Burke, Engineering Manager, Google 14 May
  • 50. Q&A

Editor's Notes

  1. G1 –oct 08Sdk 1.1 – Jan 091.5 – apr 091.6 – sept 092.0 – dec 092.1 – jan 10
  2. Services have lifetimes, but they are not as interesting