$30 off During Our Annual Pro Sale. View Details »

What's new in Android M

What's new in Android M

Jérémie Laval

July 23, 2015
Tweet

More Decks by Jérémie Laval

Other Decks in Technology

Transcript

  1. You should be looking at

    View Slide

  2. Hi!
    I’m Jérémie
    @jeremie_laval

    View Slide

  3. View Slide

  4. Android
    IDE
    tooling
    Android
    Component
    s Evangelis
    m
    A monkey?!

    View Slide

  5. Android
    Fanboy
    Android
    Fanboy
    Android
    Fanboy
    Banana!

    View Slide

  6. what’s new in
    Android M

    View Slide

  7. Android M Preview
    codename MNC
    Macadamia Nut Cookie
    (Marzipan?)
    (M&Ms?)

    View Slide

  8. Preview Availability

    View Slide

  9. Timeline
    A preview release ~every month
    Preview 1 Google I/O 2015
    Preview 2 July 16th
    Preview 3 August?
    Final release Late September

    View Slide

  10. Release Focus
    Polish
    Performance
    Battery savings
    7

    View Slide

  11. Platform Highlights
    New Permission Workflow
    Doze / App Standby
    Material Design Updates

    View Slide

  12. App Permissions

    View Slide

  13. Old Style

    View Slide

  14. Issues
    Prevent automatic updates
    Out-of-context
    Low user-engagement

    View Slide

  15. Advantage
    Total Developer Freedom

    View Slide

  16. The New System
    Low and high risk permission split
    → Only if your app targets M
    Contextualized asking for more
    Cope with refusal/revocation

    View Slide

  17. What you get
    Bluetooth Internet Network State
    NFC Vibrate Settings
    Flashlight Accounts Alarm

    As declared in app manifest

    View Slide

  18. Asking for a cookie
    if (CheckSelfPermission (this, Manifest.Permission.Camera) != Permission.Granted) {

    if (ShouldShowRequestPermissionRationale (Manifest.Permission.Camera))

    Toast.MakeText (/* ... */);

    RequestPermissions (new string[] { Manifest.Permission.Camera }, RequestCamera);

    }
    public override void OnRequestPermissionsResult (int requestCode,

    string[] permissions,

    int[] grantResults)

    {

    if (requestCode == RequestCamera) {

    // Handle permission response

    }

    }

    View Slide

  19. In-app permission

    View Slide

  20. Revoke permissions

    View Slide

  21. What about “necessary”
    permissions?

    View Slide

  22. Cold start permissions

    View Slide

  23. The Battery Savers

    View Slide

  24. Doze
    Smart detect device inactivity and force shut everything
    Network is disabled
    Wake locks are ignored
    AlarmManager, Sync, JobScheduler
    prevented

    View Slide

  25. App Standby
    Automatically jail inactive applications
    Network is disabled
    Wakeups are regulated
    → Unless charging or app deemed used

    View Slide

  26. Material Updates

    View Slide

  27. Spec Updates
    1 year of Material design
    google.com/design

    View Slide

  28. New Resources
    Icon Library
    Device Metrics Tool

    View Slide

  29. Support Design Library
    Default implementation of Material
    Support Library Design
    Companion to support-v7-appcompat

    View Slide

  30. What’s in the box
    And more…
    NavigationView Snackbar Floating Action
    Button

    View Slide

  31. NavigationView
    xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:app="http://schemas.android.com/apk/res-auto"

    android:id="@+id/drawer_layout"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:fitsSystemWindows="true">


    android:id="@+id/left_drawer"

    android:layout_width="wrap_content"

    android:layout_height="match_parent"

    android:layout_gravity="start"

    app:headerLayout="@layout/drawerheader"

    app:menu="@menu/drawer_menu" />


    View Slide

  32. NavigationView


    android:id="@+id/drawer_nav_map"

    android:checked="true"

    android:icon="@drawable/ic_drawer_map"

    android:title="Map"

    android:orderInCategory="0" />

    android:id="@+id/drawer_nav_favorites"

    android:icon="@drawable/ic_drawer_star"

    android:title="Favorites"

    android:orderInCategory="1" />

    android:id="@+id/drawer_nav_rentals"

    android:icon="@drawable/ic_drawer_rentals"

    android:title="Rental History"

    android:orderInCategory="2" />



    View Slide

  33. SnackBar
    Snackbar.Make (view, "Here's a snackbar!", Snackbar.LengthLong)

    .SetAction ("Action", v => {})

    .Show ();

    View Slide

  34. Floating Action Button
    android:id="@+id/fab"

    android:layout_width="wrap_content"

    android:layout_height="wrap_content"

    android:layout_gravity="end|bottom"

    android:layout_margin="@dimen/fab_margin"

    android:src="@drawable/ic_add" />

    View Slide

  35. CoordinatorLayout
    Anchor floating items
    Choreograph view movements
    Implement interaction patterns

    View Slide

  36. CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:app="http://schemas.android.com/apk/res-auto"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:fitsSystemWindows="true">

    android:id="@+id/appbar" />


    android:layout_height="wrap_content"

    android:layout_width="wrap_content"

    android:src="@drawable/ic_discuss"

    android:layout_margin="@dimen/fab_margin"

    app:layout_anchor="@id/appbar"

    app:layout_anchorGravity="bottom|right|end"

    app:layout_behavior="FloatingActionButton.Behavior" />


    View Slide

  37. Behaviors
    CoordinatorLayout.Behavior
    LayoutDependsOn / OnDependentViewChanged
    OnLayoutChild/OnMeasureChild
    OnInterceptTouchEvent/OnTouchEvent
    OnNested*Scroll/OnNested*Fling

    View Slide

  38. Custom behavior
    public class InfoPaneFabBehavior : CoordinatorLayout.Behavior

    {

    // …


    public override bool LayoutDependsOn (CoordinatorLayout parent, Java.Lang.Object child, View dependency)

    {

    return dependency is InfoPane;

    }


    public override bool OnDependentViewChanged (CoordinatorLayout parent, Java.Lang.Object child, View dependency)

    {

    // Move the fab vertically to place correctly wrt the info pane

    var fab = child.JavaCast ();

    var currentInfoPaneY = ViewCompat.GetTranslationY (dependency);

    var newTransY = (int)Math.Max (0, dependency.Height - currentInfoPaneY - minMarginBottom - fab.Height / 2);

    ViewCompat.SetTranslationY (fab, -newTransY);


    // If alternating between open/closed state, change the FAB face

    if (wasOpened ^ ((InfoPane)dependency).Opened) {

    fab.Switch ();

    wasOpened = !wasOpened;

    }


    return true;

    }

    }

    View Slide

  39. Custom behavior

    View Slide

  40. M Checklist
    Think about your permission workflow
    Be careful that Doze won’t break your app
    Consider porting your app to appcompat

    View Slide

  41. Links
    Google I/O 2015 talks
    Permissions youtu.be/f17qe9vZ8RM
    Material Now youtu.be/8UicJ0SxBwA
    Samples
    github.com/xamarin/monodroid-samples/tree/master/android-m
    github.com/xamarin/monodroid-samples/tree/master/android5.0/Cheesesquare
    Blogs
    android-developers.blogspot.com/2015/05/android-design-support-library.html
    blog.xamarin.com/add-beautiful-material-design-with-the-android-support-design-library/

    View Slide