8. Android ecosystem
• thousands of devices"
• the most popular mobile platform"
• 1.5 million new devices activated every day"
– Q2 2013"
• September 3, 2013, 1 billion Android
devices have been activated"
• most devices made by Samsung "
– 65%, Feb 2014
9. Google Play
• apps are distributed by app stores"
– Google Play, http://play.google.com"
– other stores (Amazon, Samsung, …)"
• > 50 billion apps have been installed from
Google Play"
• > 1.3 million apps
10. Google Play
• customers can purchase"
• developers can sell"
• Play Music "
• Play Books "
• Play Movies
13. Android security
• app can be installed directly"
– .apk file"
• user accepts app permissions when
installing or updating the app
14. Android security
• Verify Apps (Android 2.3+)"
– checks every app install"
• Google Play can remotely uninstall harmful
apps
15.
16.
17. Development
• programming in “Java”"
– Java SE 7 (KitKat)"
• native apps possible (C++)"
• development tools platform friendly"
– Windows, Linux, Mac OS X
18. Development
• IDE support"
– Android Studio, IntelliJ IDEA"
– ADT plugin for Eclipse"
– Netbeans"
• you can freely develop on any device
25. Activity
• screen with user interface"
• the only visual component"
• example - an email app"
– list of emails"
– details of an email"
– email composition
26. Service
• has no UI"
• long-running tasks"
• examples"
– music playback service"
– download service"
– sync service
27. Content Provider
• managers and shares application data"
• data storage doesn’t matter (db, web,
filesystem)"
• apps can query and modify data through
content provider"
• r/w permissions can be defined"
• examples - all system dbs (SMS,
contacts, ...)
28. Broadcast Receiver
• responds to broadcasts"
• broadcasts are system wide"
• can be registered statically or dynamically"
• system or custom messages"
• examples - incoming SMS, incoming call,
screen turned off, low baterry, removed SD
card, BT device available, ...
29. AndroidManifest.xml
• defines what parts the app have"
• defines which endpoints are exposed"
• minimum/maximum API level"
• permissions"
• declare hardware and software features"
• require configuration
30. Intent
• asynchronous message"
• binds components together (all except
Content Provider)"
• starting activities"
• starting services and binding to services"
• sending broadcasts
35. Activity
• a subclass of android.app.Activity"
• app usually has many activities"
• activities managed in activity stack"
– newly started activity is placed on the
top of the stack
36. Activity Lifecycle
• activity can be in different states during its
lifecycle"
– foreground, visible, stopped, killed"
• when activity state changes a system
callback is called
37. Activity callbacks
• onCreate() - activity created"
• onStart() - activity visible for the user"
• onResume() - activity gains user focus
38. Activity callbacks
• onPause() - system resuming another
activity"
• onStop() - activity becoming invisible to the
user"
• onDestroy() - before activity is destroyed
39. Activity callbacks
• onRestart() - called if activity was
previously stopped, called prior to onStart()
40.
41.
42. Configuration changes
• when configuration changes, activities are
destroyed and recreated"
– default behaviour, can be changed"
• properly handle config changes"
– onSaveInstanceState(Bundle)
43. Intent & Activity
• starting activity explicitly"
– new Intent(context, MyActivity.class)!
• starting activity implicitly"
– new Intent(Intent.ACTION_VIEW,
Uri.parse(“http://developer.android.com”))!
• starting activity for result
44. User Interface
• defined by a hierarchy of views"
• layouts = containers"
– LinearLayout, RelativeLayout, FrameLayout, ...
46. User Interface
• list widgets"
– subclasses of AdapterView"
– display a list of items"
– use adapter to bind list do data"
– ListView, GridView, Spinner, ...
47. Adapters
• provide data for Adapter views"
• are responsible for the creation of items
64. Threads
• main thread = UI thread"
• do not ever block the UI thread!!!"
• use worker threads for time consuming
operations"
• UI toolkit not thread safe - never
manipulate UI from a worker thread