From 8cf3c1b53203a4d6802b67a43803f3e3ee6866b7 Mon Sep 17 00:00:00 2001
From: Eric Schmidt {@link
android.content.Context#registerReceiver Context.registerReceiver()}
-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.
+
+ Warning: 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 + Background Optimizations.
+ 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 + Manipulating + Broadcast Receivers on Demand. +
+Tip: 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 side-effect of this approach is that your app will wake the device each time any of these -receivers is triggered—potentially much more frequently than required.
-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.
++ Warning: 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 + Background Optimizations. +