Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Quick Settings & Split Screen in Android N

Quick Settings & Split Screen in Android N

This presentation gives you a detailed information about how you create your own Quick Settings Tile in Android N.

And how you can add Multi Window: Split Screen support of your app for Android N


Dhrumil Shah

July 24, 2016


  1. Quick Settings & Split Screen In Android N By: Dhrumil

  2. Dhrumil Shah Lead Android App Developer, @Bugle Technologies Pvt. Ltd

    Co-organizer, Google Developers Group Ahmedabad
  3. Quick Settings

  4. Quick Settings - Use Cases • Shortcuts • Activity Shortcuts

    • Actions • Tile Abuse
  5. Caution ! ! ! Quick Settings tiles are reserved for

    controls or actions that are either urgently required or frequently used, and should not be used as shortcuts to launching an app. From: Google Official Documentation
  6. Limitations ! ! ! • Tile only can have icons

    of a single color. White/Grey • No RemoteView. ◦ I.e. No expandable state for tile
  7. What exactly in this API?

  8. What exactly in this API? package android.service.quicksettings Classes Tile TileService

  9. Tile Class • A Tile holds the state of a

    tile that will be displayed in Quick Settings. • A tile in Quick Settings exists as an icon with an accompanied label. • It also may have content description for accessibility usability. • The style and layout of the tile may change to match a given device.
  10. TileService Class • TileService is a subclass of Service •

    A TileService provides the user a tile that can be added to Quick Settings. • Quick Settings is a space provided that allows the user to change settings and take quick actions without leaving the context of their current app.
  11. Life Cycle of TileService Class • The life cycle of

    the TileService is different from the other services. • It may be unbound during parts of its lifecycle. ❏ When a tile is added by the user its TileService will be bound to and onTileAdded() will be called. ❏ When a tile should be up to date and listing will be indicated by onStartListening() and onStopListening(). ❏ When the user removes a tile from Quick Settings onTileRemoved() will be called.
  12. Let’s Start Reference URL to clone: http://tinyurl.com/QSTdemo

  13. Split Screen

  14. Why Split Screen? • Average Mobile Screen size 5 inches.

    • Require actual multitasking environment • Utilize the full screen in actual manner
  15. How to add support of Split Screen? • AndroidManifest.xml ◦

    android:resizeableActivity=["true" | "false"] ◦ Layout attributes ▪ <activity android:name=".MyActivity"> <layout android:defaultHeight="500dp" android:defaultWidth="600dp" android:gravity="top|end" android:minHeight="450dp" android:minWidth="300dp" /> </activity> Source: https://developer.android.com/preview/features/multi-window.html
  16. Activity Life Cycle in Split Screen • In multi-window mode,

    an app can be in the paused state and still be visible to the user. • An app might need to continue its activities even while paused. For example, a video-playing app that is in paused mode but is visible should continue showing its video. • For this reason, Google recommend that activities that play video not pause the video in their onPause() handlers. Instead, they should pause video in onStop(), and resume playback in onStart(). Source: https://developer.android.com/preview/features/multi-window.html#running
  17. Check the Display mode • Android N has introduced an

    Activity method to check whether you are in Multiwindow mode or not. Activity.isInMultiWindowMode()
  18. Tips from Expert 1. User the right Context 2. Handle

    configuration changes correctly 3. Handle all orientations 4. Build a responsive UI for all screen sizes 5. Activities started by other apps must always support multi-window By: Ian Lake (Android Developer Advocate at Google)
  19. Let’s Explore Reference URL to clone: http://tinyurl.com/SplitScreenDemo

  20. Thanks :)