summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/html/guide/topics/manifest/receiver-element.jd14
-rw-r--r--docs/html/training/articles/perf-anr.jd18
-rw-r--r--docs/html/training/monitoring-device-state/manifest-receivers.jd20
3 files changed, 46 insertions, 6 deletions
diff --git a/docs/html/guide/topics/manifest/receiver-element.jd b/docs/html/guide/topics/manifest/receiver-element.jd
index 800ee8a6e4c7..c866047447e0 100644
--- a/docs/html/guide/topics/manifest/receiver-element.jd
+++ b/docs/html/guide/topics/manifest/receiver-element.jd
@@ -33,8 +33,18 @@ There are two ways to make a broadcast receiver known to the system: One is
declare it in the manifest file with this element. The other is to create
the receiver dynamically in code and register it with the <code>{@link
android.content.Context#registerReceiver Context.registerReceiver()}</code>
-method. See the {@link android.content.BroadcastReceiver} class description
-for more on dynamically created receivers.
+method. For more information about how to dynamically create receivers, see the
+{@link android.content.BroadcastReceiver} class description.
+</p>
+
+<p class="warning">
+ <strong>Warning:</strong> Limit how many broadcast
+ receivers you set in your app. Having too many broadcast receivers can
+ affect your app's performance and the battery life of users' devices.
+ For more information about APIs you can use instead of the
+ {@link android.content.BroadcastReceiver} class for scheduling background
+ work, see
+ <a href="/topic/performance/background-optimization.html">Background Optimizations</a>.
</p></dd>
<dt>attributes:</dt>
diff --git a/docs/html/training/articles/perf-anr.jd b/docs/html/training/articles/perf-anr.jd
index 2eda4fa679ca..58db3e2f711c 100644
--- a/docs/html/training/articles/perf-anr.jd
+++ b/docs/html/training/articles/perf-anr.jd
@@ -14,6 +14,14 @@ page.article=true
<li><a href="#Reinforcing">Reinforcing Responsiveness</a></li>
</ol>
+<h2>You should also read</h2>
+<ul>
+ <li><a href="/topic/performance/background-optimization.html">Background Optimizations</a>
+ <li><a href="/topic/performance/scheduling.html">Intelligent Job-Scheduling</a>
+ <li><a href="/training/monitoring-device-state/manifest-receivers.html">Manipulating Broadcast Receivers On Demand</a>
+ <li><a href="/guide/components/intents-filters.html">Intents and Intent Filters</a>
+</ul>
+
</div>
</div>
@@ -165,6 +173,16 @@ application should start an {@link android.app.IntentService} if a
potentially long running action needs to be taken in response to an intent
broadcast.</p>
+<p>
+ Another common issue with {@link android.content.BroadcastReceiver} objects
+ occurs when they execute too frequently. Frequent background execution can
+ reduce the amount of memory available to other apps.
+ For more information about how to enable and disable
+ {@link android.content.BroadcastReceiver} objects efficiently, see
+ <a href="/training/monitoring-device-state/manifest-receivers.html">Manipulating
+ Broadcast Receivers on Demand</a>.
+</p>
+
<p class="note"><strong>Tip:</strong>
You can use {@link android.os.StrictMode} to help find potentially
long running operations such as network or database operations that
diff --git a/docs/html/training/monitoring-device-state/manifest-receivers.jd b/docs/html/training/monitoring-device-state/manifest-receivers.jd
index 3e36dba741a1..5efa2facf901 100644
--- a/docs/html/training/monitoring-device-state/manifest-receivers.jd
+++ b/docs/html/training/monitoring-device-state/manifest-receivers.jd
@@ -21,7 +21,10 @@ Efficiency</a></li>
<h2>You should also read</h2>
<ul>
- <li><a href="{@docRoot}guide/components/intents-filters.html">Intents and Intent Filters</a>
+ <li><a href="/topic/performance/background-optimization.html">Background Optimizations</a>
+ <li><a href="/topic/performance/scheduling.html">Intelligent Job-Scheduling</a>
+ <li><a href="/training/articles/perf-anr.html">Keeping Your App Responsive</a>
+ <li><a href="/guide/components/intents-filters.html">Intents and Intent Filters</a>
</ul>
</div>
@@ -32,13 +35,22 @@ android.content.BroadcastReceiver} for each state you're monitoring and register
your application manifest. Then within each of these receivers you simply reschedule your recurring
alarms based on the current device state.</p>
-<p>A side-effect of this approach is that your app will wake the device each time any of these
-receivers is triggered&mdash;potentially much more frequently than required.</p>
-
<p>A better approach is to disable or enable the broadcast receivers at runtime. That way you can
use the receivers you declared in the manifest as passive alarms that are triggered by system events
only when necessary.</p>
+<p class="warning">
+ <strong>Warning:</strong> Limit how many broadcast
+ receivers you set in your app. Instead of using broadcast receivers,
+ consider using other APIs for
+ performing background work. For example, in Android 5.0 (API level 21) and
+ higher, you can use the {@link android.app.job.JobScheduler} class for
+ assigning work to be completed in the background.
+ For more information about APIs you can use instead of the
+ {@link android.content.BroadcastReceiver} class for scheduling background
+ work, see
+ <a href="{@docRoot}topic/performance/background-optimization.html">Background Optimizations</a>.
+</p>
<h2 id="ToggleReceivers">Toggle and Cascade State Change Receivers to Improve Efficiency </h2>