1 / 57

Introduction to Android Software Development

Introduction to Android Software Development. T-110.5130 Mobile Systems programming Juha-Matti Liukkonen juha-matti.liukkonen@reaktor.com. Introduction to Android Software Development. Introduction to Android Development Tools Interlude : The Design Step Key Android Concepts

jpitts
Télécharger la présentation

Introduction to Android Software Development

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction toAndroid Software Development • T-110.5130 Mobile Systems programming • Juha-Matti Liukkonen • juha-matti.liukkonen@reaktor.com

  2. Introduction toAndroid Software Development • Introduction to Android • Development Tools • Interlude: The Design Step • Key AndroidConcepts • PuttingYourAppTogether • Where to gonext

  3. Introduction to Android • World’smostpopular mobile operating system

  4. Android = Linux • Linux kernel • MostAndroidspecificmechanismsnowincluded in mainstream Linux kernel – wakelocks, binder, etc • Customstartupscriptmechanism • A simple, classicinit.rcscriptsolution • (Generic) applicationswritten in Java • Applications donotneed to careaboutunderlyingprocessorcapabilities • Custom Java runtime (actually 2: Dalvik, AndroidRunTime) • Optimized for lowfootprint = suitable for mobile devices

  5. 1.400.000.000 users • In 2015, 82% of new smartphonesranAndroid • 1.4 billionusers, 1.5 million new devicesactivatedeveryday • 54% totalmarketshare (and obviouslyrising) • 78% of Chinesemarket • 70% of tabletmarket • 4000+ differentdevicemodels • 400+ devicemanufacturers • Alsoused in wearables, TVs and cars • Small segmentssofar

  6. Mostdevicesareneverupdated Main versions: 6.0 2015 4.4W (watch) 2015 5.x 2014 4.4 2014 4.x 2012-2013 4.0 2011-2012 3.0 2011 2.x 2010

  7. Manyscreensizes, formfactors Also – differentinteractionmodels!

  8. Varietypros & cons • Con: your software willnotworkproperly on mostAndroiddevices • Chooseyourtargetdeviceswisely to reachyourtargetedusers! • Customizedlayouts, graphics, interactionmodelsneeded to supportdifferentdevicetypes • Somehandled via Play Storedevicefilters, somebyappmanifesttags, somebyresources, someyouneed to handle in yourcode • Pro: the sameprogrammingmodelworks on allAndroiddevices • Ifyouknowhow to create software for an Androidphone, youalsoknowhow to doit for tablets, smartwatches, cars and TVs

  9. Takeaway • Android is basically Java on Linux • It’seasy to reachgazillions of users with Androidapps • Varietymakesithard to writegoodAndroidapps

  10. Development Tools • Whatyouneed to getyourappdone

  11. The good and the bad news • Android Studio containseverythingyouneed (yay 2016!) • …just that it usually doesn’t contain it by default • For very simple apps, only for latest devices, defaults are OK • So, after Android Studio installation, remember to: • Configure -> SDK Manager • Install the Android versions you want to build software for • Also advisable to install the most common support libraries

  12. Gettingready to do software • Press ”OK” – nowyourenvironment is set up • Android Studio willgenerateapplicationskeletons for common applicationtypes for you • Allyouneed to do is …”fill in the details”

  13. Nowthingsgetinteresting • What to choose as Activity? • Whatdoesyour software actuallyneed to do? • This is the stagewhenweusuallydo…

  14. Interlude:The Design Step • The criticalstepbeforeactuallywritingany software(nothing to do with Android as such)

  15. Understandyouruse case • Whatproblemdoesyourappsolve? • For whom? (Concreteexample, no abstractpersons!) • In whichsituationdoes the problemoccur? • How does the userlaunchyourapp in thatsituation? • How doesyourappfulfill the user’sneed?

  16. Example: AdhocIdeas • Problem: helpingad-hocideasbestored (eg. appideas!) • User: my colleague Antti (willusehim for testing) • Where: in public transport, duringworkcommutes (noisyenvironmentsoaudiorecordingisn’tpolite & doesn’twork) • Launch: shortcuticon on home screen • Fulfillment: it’seasy to writefree-formtextimmediately

  17. Identify & prioritizefeatures This is clearlyourpriority #1 – if the apphasthis feature, it is alreadyuseful to Antti • Open up, instantlyready for writing • Autosaveenteredtext • Multiplenotescanbesaved • Anysavednotecanbeopenedup for reading • Anysavednotecanbeemailed • Anysavednotecanbedeleted • Bold and italictext • Emailrecipientscanbetakenfrom the addressbook • …

  18. Draft the userinterface • Pen and paperaregood – lowcost, quickiterations • Build a runnableappfromyourdoodlesusing POP • Onlinewireframeappsalsoavailable: Fluid, InDesign • Testyour design with a realuser! • Clickableprototype (POP, Fluid, InDesign) or just flippaperpics • Is yourassumptionabout the needvalid? • Is yourassumptionabout the 1st feature workflowvalid?

  19. Incremental design • Splitnon-trivialfeatures into clearworkflowsteps • Design the simplestpossibleimplementation for eachstep • Thinkhoweachstepcanbeimprovedlater on (ifneeded) • Implement the simplestvariantend-to-end • Nowgotestit with the realuser – what’s the user’spriority, whichstepwouldbenefitmostfrom an improvement? • Does the userbenefitmorefrom an improvement to the existingminimalworkflow, orfrom a new feature?

  20. User storyslicing By Arto Eskelinen,seeslideshare.com

  21. Takeaway • Thinkaboutyourappbeforecodingit • Testyourconcept with a realuser • Paperorwireframeappsaregood for getting feedback • Implementsomethingsimpleend-to-endfirst, addcomplexitylater, whenithasvalue

  22. Key AndroidConcepts • Whatyouneed to knowaboutAndroidappstructure

  23. IntentslaunchActivities • Eachscreen with a userinterface is an Activity • A notewritingscreen, a list of notes, appsettings, … • The user is focused on doing one thing • A component in yourappimplementsone Activity • YourappusuallyhasmultipleActivities (so, alsomultiplecomponents) • Components invokeotherActivitiesusingIntents • Simplypass an Intentobject to startActivity() • Activities in otherappscanalsobeinvoked – for example, viewingwebpagescaninvoke Activity in the browserapp • Yourappcanpublishany Activity itimplements via itsmanifestfile

  24. Non-interactiveactivities • A Service is a component running in the background • Playing music, fetching data, miningbitcoin, etc. • Another component canusebindService() to interact with it • A ContentProvider is a shared data manager • A music library, textnotes, searchresults etc. • Rich API inheritedfrom the ContentProviderclass • A BroadcastReceiverlistens for systemstatechanges • Batterylow, networkconnectionlost, memorylow, etc. • Mayeg. triggerautosave, show an icon in status bar, lock the screen

  25. Declaringpublicactivities This is the applicationmanifest XML file, generatedbyAndroid Studio for you

  26. FilteringIntentsyoucanserve

  27. Declaringyourrequirements Devicesthatdon’tfulfillyourmanifestrequirementscan’teveninstall the appfrom Play Store.

  28. Non-codeelements • Resources = images, view layout, localizationtext, etc. • Storedunder the res/ subdirectory in yourapp • Drawables (= images) in res/drawables/ • Localizedfiles in res/subdirectory-languagecode/ • Youcanprovidedifferentlayouts & images for differentdevicetypes • Provideresourcefilevariants for differentresolutions, aspectratios and localizations • The systemautomaticallychooses the bestmatchingresources

  29. PuttingYourAppTogether • Makingitallwork and run on yourdevice

  30. Getting to the beef • Youhavevalidatedyourappconcept with the user? • Youhavechosenyourfirst feature? • Youhavetestedyourwireframemockup with the user? • Youhavesome idea aboutActivities, Intents, the manifestfile, and resources? • YouhaveinstalledAndroid Studio? • Good: thenlet’sgetback to ”Start a new Project”… let’s click it all together!

  31. Giveyourapp a namehere

  32. Nowyouneed to decidewhichdevicetypes and versions to support…

  33. SeveraltemplateActivitiesareavailable.We’llbuildourownsochooseEmpty!SeveraltemplateActivitiesareavailable.We’llbuildourownsochooseEmpty!

  34. MainActivity is a goodname, just clickFinish!

  35. Thisskeleton is automaticallygenerated for us

  36. Click on the left at 1:Project to findall the elements of yourapp

  37. The manifestmaps the Launcher’sstart-up action (”MAIN”) to yourMainActivity

  38. Here is the layout object. Select and delete the defaultTextView Nowselectyour layout, the deviceviewappears to the right.

  39. Whendone, press Play! Drag the MultilineTextfrom the widgetpaletteon top of yourRelativeLayoutand resize to fitscreen.

  40. Selecting the device to run on • Ifyouhave a realAndroiddevice • EnableDeveloperMode in the AndroidSettingsapp • In 4.2+, go to Aboutdevice, tapBuildNumber 7 times (really!) • Connect it to your PC/Mac with a USB cable • Select the device from the pop-up that appears after Play • If you don’t • Select emulator, and choose the devicetype to emulate • Note: it’s a good idea to test on alldevicevariantsyouwish to support, soyoumaywant to use the emulator for othertypesevenifyouhavesomerealdevice

  41. The AdhocIdeasapp, 1st priority feature ready for usertesting! Multitasking, limitedautosave, etcprovidedbysystem.

  42. Drag a button to your Layout, giveit a label Resize the UIelements to fit

  43. The editorwill help youadd the imports Write a function to implementdesiredbehavior (e.g. sendemail)

  44. In layout view, select the button, thenselectyour new function as itsonClickeventhandler

More Related