This document provides an overview of key features in Android N and how to update apps for compatibility. It discusses multi-window support, drag and drop, notifications, quick settings tiles, and other topics. Code samples are provided to demonstrate implementing features like multi-window layouts, drag and drop permissions, creating notifications, and using the TileService API for quick settings tiles.
15. ConnectivityManager connMgr = (ConnectivityManager)
getSystemService(Context.CONNECTIVITY_SERVICE);
if (connMgr.isActiveNetworkMetered()) {
switch (connMgr.getRestrictBackgroundStatus) {
case RESTRICT_BACKGROUND_STATUS_ENABLED:
// bg data blocked, use less data in fg too
break;
case RESTRICT_BACKGROUND_STATUS_WHITELISTED:
// App should limit usage in fg and bg
break;
case RESTRICT_BACKGROUND_STATUS_DISABLED:
// data saver disabled, but still on metered network
break; }
29. Drag And Drop
android.view.DragAndDropPermissions
Token object responsible for specifying the permissions granted to
the app that receives a drop.
View.startDragAndDrop()
View.DRAG_FLAG_GLOBAL
View.DRAG_FLAG_GLOBAL_URI_READ
View.DRAG_FLAG_GLOBAL_URI_WRITE
30. Drag And Drop
android.view.DragAndDropPermissions
Token object responsible for specifying the permissions granted to
the app that receives a drop.
View.startDragAndDrop()
View.DRAG_FLAG_GLOBAL
View.DRAG_FLAG_GLOBAL_URI_READ
View.DRAG_FLAG_GLOBAL_URI_WRITE
View.cancelDragAndDrop()
View.updateDragShadow()
31. Drag And Drop
android.view.DragAndDropPermissions
Token object responsible for specifying the permissions granted to
the app that receives a drop.
View.startDragAndDrop()
View.DRAG_FLAG_GLOBAL
View.DRAG_FLAG_GLOBAL_URI_READ
View.DRAG_FLAG_GLOBAL_URI_WRITE
View.cancelDragAndDrop()
View.updateDragShadow()
Activity.requestDragAndDropPermissions()
Requests the permissions for the content URIs passed
with the ClipData contained in a DragEvent.
36. Required notification contents
A Notification object must contain the following:
• A small icon, set by setSmallIcon()
• A title, set by setContentTitle()
• Detail text, set by setContentText()
Notification.DecoratedCustomViewStyle()
Notification.DecoratedMediaCustomViewStyle()
Builder.setCustomContentView()
44. Removing Notification
• The user dismisses the notification either individually or by using "Clear
All" (if the notification can be cleared).
• The user clicks the notification, and you called setAutoCancel() when you created
the notification.
• You call cancel() for a specific notification ID. This method also deletes
ongoing notifications.
• You call cancelAll(), which removes all of the notifications you previously
issued.
46. Setting Visibility
You call setVisibility() and specify one of the following values:
• VISIBILITY_PUBLIC shows the notification's full content.
• VISIBILITY_SECRET doesn't show any part of this notification on the lock screen.
• VISIBILITY_PRIVATE shows basic information, such as the notification's icon and
the content title, but hides the notification's full content.
48. Quick Settings Tile
•Tile
holds the state of a tile that will be displayed in Quick Settings
•TileService
provides the user a tile that can be added to Quick Settings
58. Using Dynamic Shortcuts
Dynamic shortcuts should provide links to
specific, context-sensitive actions within
your app. These actions can change
between uses of your app, and they can
change even while your app is running. Good
candidates for dynamic shortcuts include
calling a specific person, navigating to a
specific location, and viewing the current
score for a specific game.
59. The ShortcutManager API allows you to complete the following
operations on dynamic shortcuts:
• Publish: Use setDynamicShortcuts(List) to redefine the entire
list of dynamic shortcuts, or use addDynamicShortcuts(List)
to augment an existing list of dynamic shortcuts.
• Update: Use the updateShortcuts(List) method.
• Remove: Remove a set of dynamic shortcuts using
removeDynamicShortcuts(List), or remove all dynamic
shortcuts using removeAllDynamicShortcuts().
62. • Enhanced Live Wallpaper Metadata
• Round Icon Resources
When a launcher requests an app icon, the
framework returns either android:icon or
android:roundIcon, depending on the device
build configuration.
63. • Storage Manager Intent
• Improved VR Thread Scheduling
• Demo User Hint
Apps can now check to see if the device is running as the demo user.
• APIs for Carriers and Calling Apps
• New Screen Densities for Wear Devices
• DENSITY_260
• DENSITY_300
• DENSITY_340