Slide 1

Slide 1 text

Quick Settings & Split Screen In Android N By: Dhrumil Shah

Slide 2

Slide 2 text

Dhrumil Shah Lead Android App Developer, @Bugle Technologies Pvt. Ltd Co-organizer, Google Developers Group Ahmedabad

Slide 3

Slide 3 text

Quick Settings

Slide 4

Slide 4 text

Quick Settings - Use Cases ● Shortcuts ● Activity Shortcuts ● Actions ● Tile Abuse

Slide 5

Slide 5 text

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

Slide 6

Slide 6 text

Limitations ! ! ! ● Tile only can have icons of a single color. White/Grey ● No RemoteView. ○ I.e. No expandable state for tile

Slide 7

Slide 7 text

What exactly in this API?

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

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.

Slide 10

Slide 10 text

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.

Slide 11

Slide 11 text

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.

Slide 12

Slide 12 text

Let’s Start Reference URL to clone: http://tinyurl.com/QSTdemo

Slide 13

Slide 13 text

Split Screen

Slide 14

Slide 14 text

Why Split Screen? ● Average Mobile Screen size 5 inches. ● Require actual multitasking environment ● Utilize the full screen in actual manner

Slide 15

Slide 15 text

How to add support of Split Screen? ● AndroidManifest.xml ○ android:resizeableActivity=["true" | "false"] ○ Layout attributes ■ Source: https://developer.android.com/preview/features/multi-window.html

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

Check the Display mode ● Android N has introduced an Activity method to check whether you are in Multiwindow mode or not. Activity.isInMultiWindowMode()

Slide 18

Slide 18 text

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)

Slide 19

Slide 19 text

Let’s Explore Reference URL to clone: http://tinyurl.com/SplitScreenDemo

Slide 20

Slide 20 text

Thanks :)