Merge "Merge "Docs: Added new Whitelist feature to Data Saver for DP3 (Part 2)" into mnc-io-docs am: d5ef1ef028 am: ac5dc2f581" into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
16464db17c
@@ -14,7 +14,7 @@ page.keywords="android N", "data usage", "metered network"
|
|||||||
<a href="#status">Checking Data Saver Preferences</a>
|
<a href="#status">Checking Data Saver Preferences</a>
|
||||||
<ol>
|
<ol>
|
||||||
<li>
|
<li>
|
||||||
<a href="#request-whitelist">Requesting Whitelist Permissions</a>
|
<a href="#request-whitelist">Requesting whitelist permissions</a>
|
||||||
</li>
|
</li>
|
||||||
</ol>
|
</ol>
|
||||||
</li>
|
</li>
|
||||||
@@ -138,15 +138,17 @@ if (connMgr.isActiveNetworkMetered()) {
|
|||||||
If your app needs to use data in the background, it can request whitelist
|
If your app needs to use data in the background, it can request whitelist
|
||||||
permissions by sending a
|
permissions by sending a
|
||||||
<code>Settings.ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS</code>
|
<code>Settings.ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS</code>
|
||||||
(<code>"android.settings.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS"</code>)
|
intent containing a URI of your app's package name: for example,
|
||||||
intent with a <code>package:<your-app-id></code> URI.
|
<code>package:MY_APP_ID</code>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
Sending the intent and URI launches the <strong>Settings</strong> app, and
|
Sending the intent and URI launches the <strong>Settings</strong> app and
|
||||||
displays your app's <strong>App Data Usage</strong> page to the user. The
|
displays data usage settings for your app. The user can then decide whether
|
||||||
user can then decide whether to enable background data for your app.
|
to enable background data for your app. Before you send this intent, it is
|
||||||
It is good practice to prompt the user before sending this intent.
|
good practice to first ask the user if they want to launch the
|
||||||
|
<strong>Settings</strong> app for the purpose of enabling background data
|
||||||
|
usage.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2 id="monitor-changes">
|
<h2 id="monitor-changes">
|
||||||
@@ -156,9 +158,8 @@ if (connMgr.isActiveNetworkMetered()) {
|
|||||||
<p>
|
<p>
|
||||||
Apps can monitor changes to Data Saver preferences by creating a {@link
|
Apps can monitor changes to Data Saver preferences by creating a {@link
|
||||||
android.content.BroadcastReceiver} to listen for {@code
|
android.content.BroadcastReceiver} to listen for {@code
|
||||||
ConnectivityManager.ACTION_RESTRICT_BACKGROUND_CHANGED} ({@code
|
ConnectivityManager.ACTION_RESTRICT_BACKGROUND_CHANGED} and dynamically
|
||||||
"android.net.conn.RESTRICT_BACKGROUND_CHANGED"}) and dynamically registering
|
registering the receiver with {@link android.content.Context#registerReceiver
|
||||||
the receiver with {@link android.content.Context#registerReceiver
|
|
||||||
Context.registerReceiver()}. When an app receives this broadcast, it should
|
Context.registerReceiver()}. When an app receives this broadcast, it should
|
||||||
<a href="#status">check if the new Data Saver preferences affect its
|
<a href="#status">check if the new Data Saver preferences affect its
|
||||||
permissions</a> by calling {@code
|
permissions</a> by calling {@code
|
||||||
|
|||||||
Reference in New Issue
Block a user