From b1386a73ac8ff99bce98fb42e9b64b4604e71ed0 Mon Sep 17 00:00:00 2001 From: Adarsh Fernando Date: Thu, 12 May 2016 15:18:14 -0700 Subject: [PATCH] Docs: Added new Whitelist feature to Data Saver for DP3 (Part 2) Bug: 28447739 Change-Id: Ibdbf0bd315fc228b076c5b91061bcb8080de96d3 --- docs/html/preview/features/data-saver.jd | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/docs/html/preview/features/data-saver.jd b/docs/html/preview/features/data-saver.jd index d5cdf277c4d43..c4cab1841175d 100644 --- a/docs/html/preview/features/data-saver.jd +++ b/docs/html/preview/features/data-saver.jd @@ -14,7 +14,7 @@ page.keywords="android N", "data usage", "metered network" Checking Data Saver Preferences
  1. - Requesting Whitelist Permissions + Requesting whitelist permissions
@@ -138,15 +138,17 @@ if (connMgr.isActiveNetworkMetered()) { If your app needs to use data in the background, it can request whitelist permissions by sending a Settings.ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS - ("android.settings.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS") - intent with a package:<your-app-id> URI. + intent containing a URI of your app's package name: for example, + package:MY_APP_ID.

- Sending the intent and URI launches the Settings app, and - displays your app's App Data Usage page to the user. The - user can then decide whether to enable background data for your app. - It is good practice to prompt the user before sending this intent. + Sending the intent and URI launches the Settings app and + displays data usage settings for your app. The user can then decide whether + to enable background data for your app. Before you send this intent, it is + good practice to first ask the user if they want to launch the + Settings app for the purpose of enabling background data + usage.

@@ -156,9 +158,8 @@ if (connMgr.isActiveNetworkMetered()) {

Apps can monitor changes to Data Saver preferences by creating a {@link android.content.BroadcastReceiver} to listen for {@code - ConnectivityManager.ACTION_RESTRICT_BACKGROUND_CHANGED} ({@code - "android.net.conn.RESTRICT_BACKGROUND_CHANGED"}) and dynamically registering - the receiver with {@link android.content.Context#registerReceiver + ConnectivityManager.ACTION_RESTRICT_BACKGROUND_CHANGED} and dynamically + registering the receiver with {@link android.content.Context#registerReceiver Context.registerReceiver()}. When an app receives this broadcast, it should check if the new Data Saver preferences affect its permissions by calling {@code