Android basics (for newcomers)

Android basics (for newcomers)

2696500a913e29a26f38115f8ea56f71?s=128

Adrien Couque

March 24, 2015
Tweet

Transcript

  1. Paris, March 24th 2015 Android Introduction Basic concepts to understand

    Android applications
  2. Here is the legend or source Outline • Make-up of

    an app • Android ecosystem • A bit of design Android Introduction 2015 •
  3. Android Introduction 2015 • Activities • Necessary to display content

    on screen • Takes the full screen (except status bar and virtual buttons) • Should be : one activity = one user action (read, write, search, …)
  4. Android Introduction 2015 • Activities : Lifecycle Resumed Paused Stopped

  5. Android Introduction 2015 • Activities : Lifecycle

  6. Android Introduction 2015 • Activities : Fragments

  7. Android Introduction 2015 • Intents • Used to call new

    components (like Activities) • Two types of intent : • Explicit • Implicit new Intent(context, DiveCreateVisibilityActivity.class); new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
  8. Android Introduction 2015 • Implicit intents • If several applications

    can answer the intent, a picker asks the one the user wants to use
  9. Android Introduction 2015 • Implicit intents : examples • ACTION_VIEW

    content://contacts/people/1 • ACTION_DIAL content://contacts/people/1 • ACTION_VIEW tel:123 • ACTION_DIAL tel:123 • ACTION_EDIT content://contacts/people/1 • ACTION_VIEW content://contacts/people/
  10. Android Introduction 2015 • Services • Background component • Not

    linked to an activity : can survive after the leaves the app, across activities, … • Communication with Activities through Intents • Uses : • Background sync • Music • Heavy calculations
  11. Android Introduction 2015 • Broadcasts • Intents sent at the

    system level for all apps to listen • Multiple applications can be triggered by the same broadcast (vs implicit Intent) • Examples : • ACTION_BOOT_COMPLETED • ACTION_SHUTDOWN • ACTION_POWER_CONNECTED • Push
  12. Android Introduction 2015 • Content Providers • Abstraction for access

    to data (generally : database) • Can work across applications • Examples : • Contacts • Calendar
  13. Android Introduction 2015 • Manifest • Name, Icon, Package, Version

    • Permissions • Device Restrictions • Components • Activities • Services • Content Providers • Background Receivers
  14. Android Introduction 2015 • Permissions • Required (and shown) before

    installation (vs iOS) • Required for anything (> 150) : • Internet • Location • Storage • Battery stats • Bluetooth, NFC, Sensors • Acces and modify user data • Possible to create new permissions
  15. Android Introduction 2015 • Gmail permissions : 33 android.permission.AUTHENTICATE_ACCOUNTS android.permission.ACCESS_NETWORK_STATE

    android.permission.GET_ACCOUNTS android.permission.MANAGE_ACCOUNTS android.permission.INTERNET android.permission.READ_CONTACTS android.permission.WRITE_CONTACTS android.permission.READ_CALENDAR android.permission.WRITE_CALENDAR android.permission.READ_SYNC_SETTINGS android.permission.READ_SYNC_STATS android.permission.RECEIVE_BOOT_COMPLETED android.permission.SUBSCRIBED_FEEDS_READ android.permission.SUBSCRIBED_FEEDS_WRITE android.permission.USE_CREDENTIALS android.permission.VIBRATE android.permission.WAKE_LOCK android.permission.WRITE_SYNC_SETTINGS android.permission.WRITE_EXTERNAL_STORAGE com.google.android.gm.permission.READ_GMAIL com.google.android.gm.permission.WRITE_GMAIL com.google.android.googleapps.permission.GOOGLE_AUTH com.google.android.googleapps.permission.GOOGLE_AUTH.mail com.google.android.providers.gsf.permission.READ_GSERVICES com.google.android.gm.permission.AUTO_SEND com.google.android.voicesearch.AUDIO_FILE_ACCESS android.permission.DOWNLOAD_WITHOUT_NOTIFICATION android.permission.NFC com.google.android.gm.email.permission.READ_ATTACHMENT com.google.android.email.permission.READ_ATTACHMENT com.google.android.gm.email.permission.ACCESS_PROVIDER com.google.android.email.permission.ACCESS_PROVIDER android.permission.READ_PROFILE
  16. Android Introduction 2015 • Apk Manifest lib res assets classes.dex

    resources.arsc META-INF
  17. Android Introduction 2015 • Manifest : Gmail <?xml version="1.0" encoding="utf-8"

    standalone="no"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.google.android.gm" platformBuildVersionCode="21"> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.GET_ACCOUNTS"/> <uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/> <uses-permission android:name=“android.permission.INTERNET"/> <application android:icon="@mipmap/ic_launcher_mail" android:theme="@style/UnifiedEmailTheme"> <activity android:name=".welcome.WelcomeTourActivity" android:theme="@style/GmailTheme.NoActionBar.WelcomeTour"/> <activity android:name=".welcome.SetupAddressesActivity" android:theme="@style/GmailTheme.NoActionBar.SetupAddresses"/> <activity android:name=".welcome.WelcomeVideoActivity" android:theme="@style/GmailTheme.NoActionBar.Fullscreen"/> <provider android:authorities="com.google.android.gmail.attachmentprovider;com.google.android.gm.email.attachmentprovider" android:name="com.android.email.provider.AttachmentProvider"/> <receiver android:exported="true" android:name="com.android.email.service.AttachmentService$AttachmentWatchdog"/> <service android:name="com.android.mail.compose.EmptyService"/> <service android:name="com.android.mail.MailLogService"/> <service android:name="com.android.mail.browse.EmlTempFileDeletionService"/> </application> </manifest>
  18. Here is the legend or source Outline • Make-up of

    an app • Android ecosystem • A bit of design Android Introduction 2015 •
  19. Android Introduction 2015 • Fragmentation : devices

  20. Android Introduction 2015 • Fragmentation : OS

  21. Android Introduction 2015 • Fragmentation : OS

  22. Fragmentation : screens

  23. Android Introduction 2015 • Fragmentation AOSP Support Library Play Services

  24. Android Introduction 2015 • Fragmentation

  25. Android Introduction 2015 • Design

  26. 2015 • Keylines Material Design (dev)

  27. 2015 • Text Material Design (dev) @style/TextAppearance.AppCompat.Title @style/TextAppearance.AppCompat.Body1

  28. 2015 • Icons Material Design (dev) https://github.com/google/material-design-icons

  29. 2015 • Elevation Material Design (dev) ViewCompat.setElevation(view, 8dp) CardView +

    card_view:cardElevation PNG
  30. Android Introduction 2015 • Action Bar

  31. ToolBar : default metrics Material Design (dev)

  32. Android Introduction 2015 • Floating Action Button

  33. Android Introduction 2015 • Navigation Drawer

  34. Android Introduction 2015 • Navigation Drawer

  35. 2015 • Navigation Drawer Material Design (dev) https://github.com/ mikepenz/MaterialDrawer

  36. 2015 • Dialogs : AppCompatDialog Material Design (dev)

  37. 2015 • Bottom sheets Material Design (dev) https://github.com/ soarcn/BottomSheet

  38. Android Introduction 2015 • Up vs Back Navigation

  39. None
  40. Android Introduction 2015 • Up vs Back Navigation

  41. Android Introduction 2015 • Up vs Back Navigation

  42. Android Introduction 2015 • Up vs Back Navigation

  43. Android Introduction 2015 • Notifications

  44. Android Introduction 2015 • Notifications

  45. Android Introduction 2015 • Notifications

  46. Android Introduction 2015 • Notifications

  47. Android Introduction 2015 • Notifications

  48. I/O Recap 2014 • Material design

  49. Nom de la présentation 2012 • Material design Cross platform

    design: phones, tablets, laptops, web Metaphor: paper and ink Animations and transitions Shadows Vivid colors Ripples
  50. I/O Recap 2014 • Topics Android Wear Android Auto Android

    TV
  51. Any questions ? Thanks