1 page.title=Manipulating Broadcast Receivers On Demand 2 parent.title=Optimizing Battery Life 3 parent.link=index.html 4 5 trainingnavtop=true 6 7 previous.title=Determining and Monitoring the Connectivity Status 8 previous.link=connectivity-monitoring.html 9 10 @jd:body 11 12 <div id="tb-wrapper"> 13 <div id="tb"> 14 15 <h2> </h2> 16 <ol> 17 <li><a href="#ToggleReceivers">, </a></li> 18 </ol> 19 20 21 <h2> </h2> 22 <ul> 23 <li><a href="{@docRoot}guide/components/intents-filters.html"> </a> 24 </ul> 25 26 </div> 27 </div> 28 29 <p> {@link android.content.BroadcastReceiver} . .</p> 30 31 <p> : , .</p> 32 33 <p> . , , , .</p> 34 35 36 <h2 id="ToggleReceivers">, </h2> 37 38 <p>{@link android.content.pm.PackageManager} , , :</p> 39 40 <pre>ComponentName receiver = new ComponentName(context, myReceiver.class); 41 42 PackageManager pm = context.getPackageManager(); 43 44 pm.setComponentEnabledSetting(receiver, 45 PackageManager.COMPONENT_ENABLED_STATE_ENABLED, 46 PackageManager.DONT_KILL_APP)</pre> 47 48 <p> , . , , . .</p> 49 50 <p> , . , Wi-Fi.</p> 51