Loading docs/html/about/versions/nougat/android-7.0-changes.jd +25 −47 Original line number Original line Diff line number Diff line Loading @@ -182,8 +182,8 @@ certain implicit intents. </p> </p> <p> <p> For more information about background optimizations in N and how to adapt your app, For more information about background optimizations in Android 7.0 (API level see <a href= 24) and how to adapt your app, see <a href= "{@docRoot}preview/features/background-optimization.html">Background "{@docRoot}preview/features/background-optimization.html">Background Optimizations</a>. Optimizations</a>. </p> </p> Loading Loading @@ -427,12 +427,13 @@ see <a href="{@docRoot}training/secure-file-sharing/index.html">Sharing Files</a released apps, a set of libraries that see significant use—such as released apps, a set of libraries that see significant use—such as <code>libandroid_runtime.so</code>, <code>libcutils.so</code>, <code>libandroid_runtime.so</code>, <code>libcutils.so</code>, <code>libcrypto.so</code>, and <code>libssl.so</code>—are temporarily <code>libcrypto.so</code>, and <code>libssl.so</code>—are temporarily accessible on N for apps targeting API level 23 or lower. If your app loads accessible on Android 7.0 (API level 24) for apps targeting API level 23 or one of these libraries, logcat generates a warning and a toast appears on the lower. If your app loads one of these libraries, logcat generates a warning target device to notify you. If you see these warnings, you should update and a toast appears on the target device to notify you. If you see these your app to either include its own copy of those libraries or only use the warnings, you should update your app to either include its own copy of those public NDK APIs. Future releases of the Android platform may restrict the use libraries or only use the public NDK APIs. Future releases of the Android of private libraries altogether and cause your app to crash. platform may restrict the use of private libraries altogether and cause your app to crash. </p> </p> <p> <p> Loading @@ -441,9 +442,9 @@ see <a href="{@docRoot}training/secure-file-sharing/index.html">Sharing Files</a <code>System.loadLibrary</code> and <code>dlopen(3)</code> both return <code>System.loadLibrary</code> and <code>dlopen(3)</code> both return <code>NULL</code>, and may cause your app to crash. You should review your <code>NULL</code>, and may cause your app to crash. You should review your app code to remove use of private platform APIs and thoroughly test your apps app code to remove use of private platform APIs and thoroughly test your apps using a preview device or emulator. If you are unsure whether your app uses using a device or emulator running Android 7.0 (API level 24). If you are private libraries, you can <a href="#ndk-errors">check logcat</a> to identify unsure whether your app uses private libraries, you can <a href= the runtime error. "#ndk-errors">check logcat</a> to identify the runtime error. </p> </p> <p> <p> Loading @@ -454,11 +455,6 @@ see <a href="{@docRoot}training/secure-file-sharing/index.html">Sharing Files</a <table id="ndk-table"> <table id="ndk-table"> <col width="15%"> <col width="15%"> <col width="15%"> <col width="15%"> <col width="20%"> <col width="20%"> <col width="20%"> <tr> <tr> <th scope="col"> <th scope="col"> Libraries Libraries Loading @@ -470,10 +466,7 @@ see <a href="{@docRoot}training/secure-file-sharing/index.html">Sharing Files</a Runtime access via dynamic linker Runtime access via dynamic linker </th> </th> <th scope="col"> <th scope="col"> N Developer Preview behavior Android 7.0 (API level 24) behavior </th> <th scope="col"> Final N Release behavior </th> </th> <th scope="col"> <th scope="col"> Future Android platform behavior Future Android platform behavior Loading @@ -500,10 +493,6 @@ see <a href="{@docRoot}training/secure-file-sharing/index.html">Sharing Files</a <td style="background-color:#DCEDC8"> <td style="background-color:#DCEDC8"> Works as expected Works as expected </td> </td> <td style="background-color:#DCEDC8"> Works as expected </td> </tr> </tr> <tr> <tr> Loading @@ -519,11 +508,6 @@ see <a href="{@docRoot}training/secure-file-sharing/index.html">Sharing Files</a Temporarily accessible Temporarily accessible </td> </td> <td style="background-color:#FFF9C4"> Works as expected, but you receive a logcat warning and a message on the target device. </td> <td style="background-color:#FFF9C4"> <td style="background-color:#FFF9C4"> Works as expected, but you receive a logcat warning. Works as expected, but you receive a logcat warning. </td> </td> Loading Loading @@ -553,10 +537,6 @@ see <a href="{@docRoot}training/secure-file-sharing/index.html">Sharing Files</a <td style="background-color:#ffcdd2"> <td style="background-color:#ffcdd2"> Runtime error Runtime error </td> </td> <td style="background-color:#ffcdd2"> Runtime error </td> </tr> </tr> <tr> <tr> Loading @@ -579,10 +559,6 @@ see <a href="{@docRoot}training/secure-file-sharing/index.html">Sharing Files</a <td style="background-color:#ffcdd2"> <td style="background-color:#ffcdd2"> Runtime error Runtime error </td> </td> <td style="background-color:#ffcdd2"> Runtime error </td> </tr> </tr> </table> </table> Loading Loading @@ -699,8 +675,8 @@ JavaVM::AttachCurrentThread from <jni.h>. <ul> <ul> <li>You must install a delegated certificate installer before the DPC can set <li>You must install a delegated certificate installer before the DPC can set it. For both profile and device-owner apps targeting the N SDK, you should it. For both profile and device-owner apps targeting Android 7.0 (API level 24), install the delegated certificate installer before the device policy you should install the delegated certificate installer before the device policy controller (DPC) calls controller (DPC) calls <code>DevicePolicyManager.setCertInstallerPackage()</code>. If the installer <code>DevicePolicyManager.setCertInstallerPackage()</code>. If the installer is not already installed, the system throws an is not already installed, the system throws an Loading Loading @@ -747,12 +723,13 @@ JavaVM::AttachCurrentThread from <jni.h>. DER-encoded format under a .crt or .cer file extension. DER-encoded format under a .crt or .cer file extension. </li> </li> <li>Starting in Android 7.0, fingerprint enrollment and storage are managed per user. <li>Starting in Android 7.0, fingerprint enrollment and storage are managed If a profile owner’s Device Policy Client (DPC) targets pre-N on an N device, per user. If a profile owner’s Device Policy Client (DPC) targets API level the user is still able to set fingerprint on the device, but work 23 (or lower) on a device running Android 7.0 (API level 24), the user is applications cannot access device fingerprint. When the DPC targets N and still able to set fingerprint on the device, but work applications cannot above, the user can set fingerprint specifically for work profile by going to access device fingerprint. When the DPC targets API level 24 and above, the user can set <strong>Settings > Security > Work profile security</strong>. fingerprint specifically for work profile by going to <strong>Settings > Security > Work profile security</strong>. </li> </li> <li>A new encryption status <code>ENCRYPTION_STATUS_ACTIVE_PER_USER</code> is <li>A new encryption status <code>ENCRYPTION_STATUS_ACTIVE_PER_USER</code> is Loading Loading @@ -822,8 +799,9 @@ when killing the app manually via DDMS. </p> </p> <p> <p> Apps targeting N and above are not automatically killed on density changes; Apps targeting Android 7.0 (API level 24) and above are not automatically however, they may still respond poorly to configuration changes. killed on density changes; however, they may still respond poorly to configuration changes. </p> </p> </li> </li> Loading docs/html/topic/performance/background-optimization.jd +35 −33 Original line number Original line Diff line number Diff line Loading @@ -14,23 +14,23 @@ page.image=images/cards/card-nyc_2x.jpg <ol> <ol> <li> <li> <a href="#connectivity-action">Restrictions on CONNECTIVITY_ACTION</a> <a href="#connectivity-action">Restrictions on CONNECTIVITY_ACTION</a> </li> <ul> <li> <li> <a href="#sched-jobs">Scheduling Network Jobs on Unmetered <a href="#sched-jobs">Scheduling Network Jobs on Unmetered Connections</a> Connections</a> </li> </li> <li> <li> <a href="#monitor-conn">Monitoring Network Connectivity While the App <a href="#monitor-conn">Monitoring Network Connectivity While the is Running</a> App is Running</a> </li> </ul> </li> </li> <li> <li> <a href="#media-broadcasts">Restrictions on NEW_PICTURE and <a href="#media-broadcasts">Restrictions on NEW_PICTURE and NEW_VIDEO</a> NEW_VIDEO</a> </li> <ul> <li> <li> <a href="#new-jobinfo">New JobInfo methods</a> <a href="#new-jobinfo">New JobInfo methods</a> </li> </li> Loading @@ -38,6 +38,8 @@ page.image=images/cards/card-nyc_2x.jpg <li> <li> <a href="#new-jobparam">New JobParameter Methods</a> <a href="#new-jobparam">New JobParameter Methods</a> </li> </li> </ul> </li> <li> <li> <a href="#further-optimization">Further Optimizing Your App</a> <a href="#further-optimization">Further Optimizing Your App</a> Loading @@ -54,12 +56,12 @@ page.image=images/cards/card-nyc_2x.jpg </p> </p> <p> <p> To alleviate this issue, Android N applies the following To alleviate this issue, Android 7.0 (API level 24) applies the following restrictions: restrictions: </p> </p> <ul> <ul> <li>Apps targeting the Preview do not receive {@link <li>Apps targeting Android 7.0 (API level 24) do not receive {@link android.net.ConnectivityManager#CONNECTIVITY_ACTION} broadcasts if they android.net.ConnectivityManager#CONNECTIVITY_ACTION} broadcasts if they register to receive them in their manifest. Apps that are running can still register to receive them in their manifest. Apps that are running can still listen for {@code CONNECTIVITY_CHANGE} on their main thread by registering a listen for {@code CONNECTIVITY_CHANGE} on their main thread by registering a Loading @@ -70,16 +72,16 @@ page.image=images/cards/card-nyc_2x.jpg <li>Apps cannot send or receive {@link <li>Apps cannot send or receive {@link android.hardware.Camera#ACTION_NEW_PICTURE} or {@link android.hardware.Camera#ACTION_NEW_PICTURE} or {@link android.hardware.Camera#ACTION_NEW_VIDEO} broadcasts. This optimization android.hardware.Camera#ACTION_NEW_VIDEO} broadcasts. This optimization affects all apps, not only those targeting the Preview. affects all apps, not only those targeting Android 7.0 (API level 24). </li> </li> </ul> </ul> <p> <p> If your app uses any of these intents, you should remove dependencies on If your app uses any of these intents, you should remove dependencies on them them as soon as possible so that you can target Android N devices properly. as soon as possible so that you can target devices running Android 7.0 The Android framework provides several solutions to mitigate the need for properly. The Android framework provides several solutions to mitigate the these implicit broadcasts. For example, {@link android.app.job.JobScheduler} need for these implicit broadcasts. For example, {@link and <a href= android.app.job.JobScheduler} and <a href= "https://developers.google.com/android/reference/com/google/android/gms/gcm/GcmNetworkManager"> "https://developers.google.com/android/reference/com/google/android/gms/gcm/GcmNetworkManager"> {@code GcmNetworkManager}</a> provide robust mechanisms to schedule network {@code GcmNetworkManager}</a> provide robust mechanisms to schedule network operations when specified conditions, such as a connection to an unmetered operations when specified conditions, such as a connection to an unmetered Loading @@ -101,7 +103,7 @@ page.image=images/cards/card-nyc_2x.jpg </h2> </h2> <p> <p> Apps targeting the Android N do not receive {@link Apps targeting Android 7.0 (API level 24) do not receive {@link android.net.ConnectivityManager#CONNECTIVITY_ACTION} broadcasts if they android.net.ConnectivityManager#CONNECTIVITY_ACTION} broadcasts if they register to receive them in their manifest, and processes that depend on this register to receive them in their manifest, and processes that depend on this broadcast will not start. This could pose a problem for apps that want broadcast will not start. This could pose a problem for apps that want Loading Loading @@ -212,7 +214,7 @@ public static void scheduleJob(Context context) { </h3> </h3> <p> <p> To trigger jobs on content URI changes, Android N extends To trigger jobs on content URI changes, Android 7.0 (API level 24) extends the {@link android.app.job.JobInfo} API with the following methods: the {@link android.app.job.JobInfo} API with the following methods: </p> </p> Loading Loading @@ -287,7 +289,7 @@ public static void scheduleJob(Context context) { </h3> </h3> <p> <p> Android N also extends {@link android.app.job.JobParameters} to Android 7.0 (API level 24) also extends {@link android.app.job.JobParameters} to allow your app to receive useful information about what content authorities allow your app to receive useful information about what content authorities and URIs triggered the job: and URIs triggered the job: </p> </p> Loading Loading @@ -361,13 +363,13 @@ public boolean onStartJob(JobParameters params) { conditions, can improve performance and user experience. Removing conditions, can improve performance and user experience. Removing dependencies on background services and statically-registered implicit dependencies on background services and statically-registered implicit broadcast receivers can help your app run better on such devices. Although broadcast receivers can help your app run better on such devices. Although Android N takes steps to reduce some of these issues, it is Android 7.0 (API level 24) takes steps to reduce some of these issues, it is recommended that you optimize your app to run without the use of these recommended that you optimize your app to run without the use of these background processes entirely. background processes entirely. </p> </p> <p> <p> Android N introduces some additional <a href= Android 7.0 (API level 24) introduces some additional <a href= "{@docRoot}tools/help/adb.html">Android Debug Bridge (ADB)</a> commands that "{@docRoot}tools/help/adb.html">Android Debug Bridge (ADB)</a> commands that you can use to test app behavior with those background processes disabled: you can use to test app behavior with those background processes disabled: </p> </p> Loading @@ -379,7 +381,7 @@ public boolean onStartJob(JobParameters params) { <li style="list-style: none; display: inline"> <li style="list-style: none; display: inline"> <pre class="no-pretty-print"> <pre class="no-pretty-print"> {@code $ adb shell cmd appops set <package_name> RUN_IN_BACKGROUND ignore} {@code $ adb shell cmd appops set <package_name> RUN_IN_BACKGROUND ignore} </pre> </pre> </li> </li> Loading @@ -389,7 +391,7 @@ public boolean onStartJob(JobParameters params) { <li style="list-style: none; display: inline"> <li style="list-style: none; display: inline"> <pre class="no-pretty-print"> <pre class="no-pretty-print"> {@code $ adb shell cmd appops set <package_name> RUN_IN_BACKGROUND allow} {@code $ adb shell cmd appops set <package_name> RUN_IN_BACKGROUND allow} </pre> </pre> </li> </li> </ul> </ul> docs/html/training/basics/network-ops/data-saver.jd +2 −2 Original line number Original line Diff line number Diff line Loading @@ -45,7 +45,7 @@ next.link=xml.html </p> </p> <p> <p> The N Developer Preview extends the {@link android.net.ConnectivityManager} Android 7.0 (API level 24) extends the {@link android.net.ConnectivityManager} API to provide apps with a way to <a href="#status">retrieve the user’s Data API to provide apps with a way to <a href="#status">retrieve the user’s Data Saver preferences</a> and <a href="#monitor-changes">monitor preference Saver preferences</a> and <a href="#monitor-changes">monitor preference changes</a>. It is considered good practice for apps to check whether the changes</a>. It is considered good practice for apps to check whether the Loading @@ -58,7 +58,7 @@ next.link=xml.html </h2> </h2> <p> <p> In the N Developer Preview, apps can use the {@link In Android 7.0 (API level 24), apps can use the {@link android.net.ConnectivityManager} API to determine what data usage android.net.ConnectivityManager} API to determine what data usage restrictions are being applied. The {@code getRestrictBackgroundStatus()} restrictions are being applied. The {@code getRestrictBackgroundStatus()} method returns one of the following values: method returns one of the following values: Loading Loading
docs/html/about/versions/nougat/android-7.0-changes.jd +25 −47 Original line number Original line Diff line number Diff line Loading @@ -182,8 +182,8 @@ certain implicit intents. </p> </p> <p> <p> For more information about background optimizations in N and how to adapt your app, For more information about background optimizations in Android 7.0 (API level see <a href= 24) and how to adapt your app, see <a href= "{@docRoot}preview/features/background-optimization.html">Background "{@docRoot}preview/features/background-optimization.html">Background Optimizations</a>. Optimizations</a>. </p> </p> Loading Loading @@ -427,12 +427,13 @@ see <a href="{@docRoot}training/secure-file-sharing/index.html">Sharing Files</a released apps, a set of libraries that see significant use—such as released apps, a set of libraries that see significant use—such as <code>libandroid_runtime.so</code>, <code>libcutils.so</code>, <code>libandroid_runtime.so</code>, <code>libcutils.so</code>, <code>libcrypto.so</code>, and <code>libssl.so</code>—are temporarily <code>libcrypto.so</code>, and <code>libssl.so</code>—are temporarily accessible on N for apps targeting API level 23 or lower. If your app loads accessible on Android 7.0 (API level 24) for apps targeting API level 23 or one of these libraries, logcat generates a warning and a toast appears on the lower. If your app loads one of these libraries, logcat generates a warning target device to notify you. If you see these warnings, you should update and a toast appears on the target device to notify you. If you see these your app to either include its own copy of those libraries or only use the warnings, you should update your app to either include its own copy of those public NDK APIs. Future releases of the Android platform may restrict the use libraries or only use the public NDK APIs. Future releases of the Android of private libraries altogether and cause your app to crash. platform may restrict the use of private libraries altogether and cause your app to crash. </p> </p> <p> <p> Loading @@ -441,9 +442,9 @@ see <a href="{@docRoot}training/secure-file-sharing/index.html">Sharing Files</a <code>System.loadLibrary</code> and <code>dlopen(3)</code> both return <code>System.loadLibrary</code> and <code>dlopen(3)</code> both return <code>NULL</code>, and may cause your app to crash. You should review your <code>NULL</code>, and may cause your app to crash. You should review your app code to remove use of private platform APIs and thoroughly test your apps app code to remove use of private platform APIs and thoroughly test your apps using a preview device or emulator. If you are unsure whether your app uses using a device or emulator running Android 7.0 (API level 24). If you are private libraries, you can <a href="#ndk-errors">check logcat</a> to identify unsure whether your app uses private libraries, you can <a href= the runtime error. "#ndk-errors">check logcat</a> to identify the runtime error. </p> </p> <p> <p> Loading @@ -454,11 +455,6 @@ see <a href="{@docRoot}training/secure-file-sharing/index.html">Sharing Files</a <table id="ndk-table"> <table id="ndk-table"> <col width="15%"> <col width="15%"> <col width="15%"> <col width="15%"> <col width="20%"> <col width="20%"> <col width="20%"> <tr> <tr> <th scope="col"> <th scope="col"> Libraries Libraries Loading @@ -470,10 +466,7 @@ see <a href="{@docRoot}training/secure-file-sharing/index.html">Sharing Files</a Runtime access via dynamic linker Runtime access via dynamic linker </th> </th> <th scope="col"> <th scope="col"> N Developer Preview behavior Android 7.0 (API level 24) behavior </th> <th scope="col"> Final N Release behavior </th> </th> <th scope="col"> <th scope="col"> Future Android platform behavior Future Android platform behavior Loading @@ -500,10 +493,6 @@ see <a href="{@docRoot}training/secure-file-sharing/index.html">Sharing Files</a <td style="background-color:#DCEDC8"> <td style="background-color:#DCEDC8"> Works as expected Works as expected </td> </td> <td style="background-color:#DCEDC8"> Works as expected </td> </tr> </tr> <tr> <tr> Loading @@ -519,11 +508,6 @@ see <a href="{@docRoot}training/secure-file-sharing/index.html">Sharing Files</a Temporarily accessible Temporarily accessible </td> </td> <td style="background-color:#FFF9C4"> Works as expected, but you receive a logcat warning and a message on the target device. </td> <td style="background-color:#FFF9C4"> <td style="background-color:#FFF9C4"> Works as expected, but you receive a logcat warning. Works as expected, but you receive a logcat warning. </td> </td> Loading Loading @@ -553,10 +537,6 @@ see <a href="{@docRoot}training/secure-file-sharing/index.html">Sharing Files</a <td style="background-color:#ffcdd2"> <td style="background-color:#ffcdd2"> Runtime error Runtime error </td> </td> <td style="background-color:#ffcdd2"> Runtime error </td> </tr> </tr> <tr> <tr> Loading @@ -579,10 +559,6 @@ see <a href="{@docRoot}training/secure-file-sharing/index.html">Sharing Files</a <td style="background-color:#ffcdd2"> <td style="background-color:#ffcdd2"> Runtime error Runtime error </td> </td> <td style="background-color:#ffcdd2"> Runtime error </td> </tr> </tr> </table> </table> Loading Loading @@ -699,8 +675,8 @@ JavaVM::AttachCurrentThread from <jni.h>. <ul> <ul> <li>You must install a delegated certificate installer before the DPC can set <li>You must install a delegated certificate installer before the DPC can set it. For both profile and device-owner apps targeting the N SDK, you should it. For both profile and device-owner apps targeting Android 7.0 (API level 24), install the delegated certificate installer before the device policy you should install the delegated certificate installer before the device policy controller (DPC) calls controller (DPC) calls <code>DevicePolicyManager.setCertInstallerPackage()</code>. If the installer <code>DevicePolicyManager.setCertInstallerPackage()</code>. If the installer is not already installed, the system throws an is not already installed, the system throws an Loading Loading @@ -747,12 +723,13 @@ JavaVM::AttachCurrentThread from <jni.h>. DER-encoded format under a .crt or .cer file extension. DER-encoded format under a .crt or .cer file extension. </li> </li> <li>Starting in Android 7.0, fingerprint enrollment and storage are managed per user. <li>Starting in Android 7.0, fingerprint enrollment and storage are managed If a profile owner’s Device Policy Client (DPC) targets pre-N on an N device, per user. If a profile owner’s Device Policy Client (DPC) targets API level the user is still able to set fingerprint on the device, but work 23 (or lower) on a device running Android 7.0 (API level 24), the user is applications cannot access device fingerprint. When the DPC targets N and still able to set fingerprint on the device, but work applications cannot above, the user can set fingerprint specifically for work profile by going to access device fingerprint. When the DPC targets API level 24 and above, the user can set <strong>Settings > Security > Work profile security</strong>. fingerprint specifically for work profile by going to <strong>Settings > Security > Work profile security</strong>. </li> </li> <li>A new encryption status <code>ENCRYPTION_STATUS_ACTIVE_PER_USER</code> is <li>A new encryption status <code>ENCRYPTION_STATUS_ACTIVE_PER_USER</code> is Loading Loading @@ -822,8 +799,9 @@ when killing the app manually via DDMS. </p> </p> <p> <p> Apps targeting N and above are not automatically killed on density changes; Apps targeting Android 7.0 (API level 24) and above are not automatically however, they may still respond poorly to configuration changes. killed on density changes; however, they may still respond poorly to configuration changes. </p> </p> </li> </li> Loading
docs/html/topic/performance/background-optimization.jd +35 −33 Original line number Original line Diff line number Diff line Loading @@ -14,23 +14,23 @@ page.image=images/cards/card-nyc_2x.jpg <ol> <ol> <li> <li> <a href="#connectivity-action">Restrictions on CONNECTIVITY_ACTION</a> <a href="#connectivity-action">Restrictions on CONNECTIVITY_ACTION</a> </li> <ul> <li> <li> <a href="#sched-jobs">Scheduling Network Jobs on Unmetered <a href="#sched-jobs">Scheduling Network Jobs on Unmetered Connections</a> Connections</a> </li> </li> <li> <li> <a href="#monitor-conn">Monitoring Network Connectivity While the App <a href="#monitor-conn">Monitoring Network Connectivity While the is Running</a> App is Running</a> </li> </ul> </li> </li> <li> <li> <a href="#media-broadcasts">Restrictions on NEW_PICTURE and <a href="#media-broadcasts">Restrictions on NEW_PICTURE and NEW_VIDEO</a> NEW_VIDEO</a> </li> <ul> <li> <li> <a href="#new-jobinfo">New JobInfo methods</a> <a href="#new-jobinfo">New JobInfo methods</a> </li> </li> Loading @@ -38,6 +38,8 @@ page.image=images/cards/card-nyc_2x.jpg <li> <li> <a href="#new-jobparam">New JobParameter Methods</a> <a href="#new-jobparam">New JobParameter Methods</a> </li> </li> </ul> </li> <li> <li> <a href="#further-optimization">Further Optimizing Your App</a> <a href="#further-optimization">Further Optimizing Your App</a> Loading @@ -54,12 +56,12 @@ page.image=images/cards/card-nyc_2x.jpg </p> </p> <p> <p> To alleviate this issue, Android N applies the following To alleviate this issue, Android 7.0 (API level 24) applies the following restrictions: restrictions: </p> </p> <ul> <ul> <li>Apps targeting the Preview do not receive {@link <li>Apps targeting Android 7.0 (API level 24) do not receive {@link android.net.ConnectivityManager#CONNECTIVITY_ACTION} broadcasts if they android.net.ConnectivityManager#CONNECTIVITY_ACTION} broadcasts if they register to receive them in their manifest. Apps that are running can still register to receive them in their manifest. Apps that are running can still listen for {@code CONNECTIVITY_CHANGE} on their main thread by registering a listen for {@code CONNECTIVITY_CHANGE} on their main thread by registering a Loading @@ -70,16 +72,16 @@ page.image=images/cards/card-nyc_2x.jpg <li>Apps cannot send or receive {@link <li>Apps cannot send or receive {@link android.hardware.Camera#ACTION_NEW_PICTURE} or {@link android.hardware.Camera#ACTION_NEW_PICTURE} or {@link android.hardware.Camera#ACTION_NEW_VIDEO} broadcasts. This optimization android.hardware.Camera#ACTION_NEW_VIDEO} broadcasts. This optimization affects all apps, not only those targeting the Preview. affects all apps, not only those targeting Android 7.0 (API level 24). </li> </li> </ul> </ul> <p> <p> If your app uses any of these intents, you should remove dependencies on If your app uses any of these intents, you should remove dependencies on them them as soon as possible so that you can target Android N devices properly. as soon as possible so that you can target devices running Android 7.0 The Android framework provides several solutions to mitigate the need for properly. The Android framework provides several solutions to mitigate the these implicit broadcasts. For example, {@link android.app.job.JobScheduler} need for these implicit broadcasts. For example, {@link and <a href= android.app.job.JobScheduler} and <a href= "https://developers.google.com/android/reference/com/google/android/gms/gcm/GcmNetworkManager"> "https://developers.google.com/android/reference/com/google/android/gms/gcm/GcmNetworkManager"> {@code GcmNetworkManager}</a> provide robust mechanisms to schedule network {@code GcmNetworkManager}</a> provide robust mechanisms to schedule network operations when specified conditions, such as a connection to an unmetered operations when specified conditions, such as a connection to an unmetered Loading @@ -101,7 +103,7 @@ page.image=images/cards/card-nyc_2x.jpg </h2> </h2> <p> <p> Apps targeting the Android N do not receive {@link Apps targeting Android 7.0 (API level 24) do not receive {@link android.net.ConnectivityManager#CONNECTIVITY_ACTION} broadcasts if they android.net.ConnectivityManager#CONNECTIVITY_ACTION} broadcasts if they register to receive them in their manifest, and processes that depend on this register to receive them in their manifest, and processes that depend on this broadcast will not start. This could pose a problem for apps that want broadcast will not start. This could pose a problem for apps that want Loading Loading @@ -212,7 +214,7 @@ public static void scheduleJob(Context context) { </h3> </h3> <p> <p> To trigger jobs on content URI changes, Android N extends To trigger jobs on content URI changes, Android 7.0 (API level 24) extends the {@link android.app.job.JobInfo} API with the following methods: the {@link android.app.job.JobInfo} API with the following methods: </p> </p> Loading Loading @@ -287,7 +289,7 @@ public static void scheduleJob(Context context) { </h3> </h3> <p> <p> Android N also extends {@link android.app.job.JobParameters} to Android 7.0 (API level 24) also extends {@link android.app.job.JobParameters} to allow your app to receive useful information about what content authorities allow your app to receive useful information about what content authorities and URIs triggered the job: and URIs triggered the job: </p> </p> Loading Loading @@ -361,13 +363,13 @@ public boolean onStartJob(JobParameters params) { conditions, can improve performance and user experience. Removing conditions, can improve performance and user experience. Removing dependencies on background services and statically-registered implicit dependencies on background services and statically-registered implicit broadcast receivers can help your app run better on such devices. Although broadcast receivers can help your app run better on such devices. Although Android N takes steps to reduce some of these issues, it is Android 7.0 (API level 24) takes steps to reduce some of these issues, it is recommended that you optimize your app to run without the use of these recommended that you optimize your app to run without the use of these background processes entirely. background processes entirely. </p> </p> <p> <p> Android N introduces some additional <a href= Android 7.0 (API level 24) introduces some additional <a href= "{@docRoot}tools/help/adb.html">Android Debug Bridge (ADB)</a> commands that "{@docRoot}tools/help/adb.html">Android Debug Bridge (ADB)</a> commands that you can use to test app behavior with those background processes disabled: you can use to test app behavior with those background processes disabled: </p> </p> Loading @@ -379,7 +381,7 @@ public boolean onStartJob(JobParameters params) { <li style="list-style: none; display: inline"> <li style="list-style: none; display: inline"> <pre class="no-pretty-print"> <pre class="no-pretty-print"> {@code $ adb shell cmd appops set <package_name> RUN_IN_BACKGROUND ignore} {@code $ adb shell cmd appops set <package_name> RUN_IN_BACKGROUND ignore} </pre> </pre> </li> </li> Loading @@ -389,7 +391,7 @@ public boolean onStartJob(JobParameters params) { <li style="list-style: none; display: inline"> <li style="list-style: none; display: inline"> <pre class="no-pretty-print"> <pre class="no-pretty-print"> {@code $ adb shell cmd appops set <package_name> RUN_IN_BACKGROUND allow} {@code $ adb shell cmd appops set <package_name> RUN_IN_BACKGROUND allow} </pre> </pre> </li> </li> </ul> </ul>
docs/html/training/basics/network-ops/data-saver.jd +2 −2 Original line number Original line Diff line number Diff line Loading @@ -45,7 +45,7 @@ next.link=xml.html </p> </p> <p> <p> The N Developer Preview extends the {@link android.net.ConnectivityManager} Android 7.0 (API level 24) extends the {@link android.net.ConnectivityManager} API to provide apps with a way to <a href="#status">retrieve the user’s Data API to provide apps with a way to <a href="#status">retrieve the user’s Data Saver preferences</a> and <a href="#monitor-changes">monitor preference Saver preferences</a> and <a href="#monitor-changes">monitor preference changes</a>. It is considered good practice for apps to check whether the changes</a>. It is considered good practice for apps to check whether the Loading @@ -58,7 +58,7 @@ next.link=xml.html </h2> </h2> <p> <p> In the N Developer Preview, apps can use the {@link In Android 7.0 (API level 24), apps can use the {@link android.net.ConnectivityManager} API to determine what data usage android.net.ConnectivityManager} API to determine what data usage restrictions are being applied. The {@code getRestrictBackgroundStatus()} restrictions are being applied. The {@code getRestrictBackgroundStatus()} method returns one of the following values: method returns one of the following values: Loading