Solve the problem that the Xiaomi phone cannot receive the boot broadcast
Last Update:2015-08-05
Source: Internet
Author: User
<span id="Label3"></p><p><p>Today in a push to push the time encountered a Xiaomi phone can not receive the issue of the boot Broadcast.</p></p><p><p> <span style="margin:0px; padding:0px; border:none; color:black; background-color:inherit;"><span style="margin:0px; padding:0px; border:none; Color:rgb (153, 51, 0); font-weight:bold; background-color:inherit; ">< </span> <span style="margin:0px; padding:0px; border:none; Color:rgb (153, 51, 0); font-weight:bold; background-color:inherit; ">receiver </span> <span style="margin:0px; padding:0px; border:none; background-color:inherit;"> </span> <span style="margin:0px; padding:0px; border:none; color:red; background-color:inherit;">android: Name </span> <span style="margin:0px; padding:0px; border:none; background-color:inherit;">= "com. xxxxxxxxxxx </span> <span style="margin:0px; padding:0px; border:none; Color:rgb (153, 51, 0); font-weight:bold; background-color:inherit; ">>, </span> <span style="margin:0px; padding:0px; border:none; background-color:inherit;"> </span></span></p></p><p><p><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span style="margin: 0px; padding: 0px; border: none; color: rgb(153, 51, 0); font-weight: bold; background-color: inherit;"><</span> <span style="margin: 0px; padding: 0px; border: none; color: rgb(153, 51, 0); font-weight: bold; background-color: inherit;">Intent-filter</span> <span style="margin: 0px; padding: 0px; border: none; color: rgb(153, 51, 0); font-weight: bold; background-color: inherit;">></span> <span style="margin: 0px; padding: 0px; border: none; background-color: inherit;"> </span></span></p></p><p><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span style="margin: 0px; padding: 0px; border: none; color: rgb(153, 51, 0); font-weight: bold; background-color: inherit;"><span style="margin: 0px; padding: 0px; border: none; color: rgb(153, 51, 0); font-weight: bold; background-color: inherit;"><</span></span><span style="margin: 0px; padding: 0px; border: none; color: rgb(153, 51, 0); font-weight: bold; background-color: inherit;"><span style="margin: 0px; padding: 0px; border: none; color: rgb(153, 51, 0); font-weight: bold; background-color: inherit;">Action</span></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;"><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;"> </span></span><span style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit;"><span style="margin: 0px; padding: 0px; border: none; color: red; background-color: inherit;">Android:name</span></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;"><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">=</span></span><span style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;"><span style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">"android.intent.action.BOOT_COMPLETED"</span></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;"><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;"> </span></span><span style="margin: 0px; padding: 0px; border: none; color: rgb(153, 51, 0); font-weight: bold; background-color: inherit;"><span style="margin: 0px; padding: 0px; border: none; color: rgb(153, 51, 0); font-weight: bold; background-color: inherit;">/></span></span><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;"><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;"> </span></span></span></p><p><p><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span style="margin: 0px; padding: 0px; border: none; color: rgb(153, 51, 0); font-weight: bold; background-color: inherit;"></</span> <span style="margin: 0px; padding: 0px; border: none; color: rgb(153, 51, 0); font-weight: bold; background-color: inherit;">Intent-filter</span> <span style="margin: 0px; padding: 0px; border: none; color: rgb(153, 51, 0); font-weight: bold; background-color: inherit;">></span> <span style="margin: 0px; padding: 0px; border: none; background-color: inherit;"> </span></span></p></p><p><p><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span style="margin: 0px; padding: 0px; border: none; color: rgb(153, 51, 0); font-weight: bold; background-color: inherit;"></</span> <span style="margin: 0px; padding: 0px; border: none; color: rgb(153, 51, 0); font-weight: bold; background-color: inherit;">receiver</span> <span style="margin: 0px; padding: 0px; border: none; color: rgb(153, 51, 0); font-weight: bold; background-color: inherit;">></span> <span style="margin: 0px; padding: 0px; border: none; background-color: inherit;"> </span></span></p></p><p style="color: rgb(54, 46, 43); font-family: Arial; font-size: 14px; line-height: 26px; white-space: normal; background-color: rgb(255, 255, 255);"><p style="color: rgb(54, 46, 43); font-family: Arial; font-size: 14px; line-height: 26px; white-space: normal; background-color: rgb(255, 255, 255);">The start-up broadcast is easy to write, as shown in the code above, but this code fails on the Xiaomi phone</p></p><p style="color: rgb(54, 46, 43); font-family: Arial; font-size: 14px; line-height: 26px; white-space: normal; background-color: rgb(255, 255, 255);"><p style="color: rgb(54, 46, 43); font-family: Arial; font-size: 14px; line-height: 26px; white-space: normal; background-color: rgb(255, 255, 255);">In fact, it is very simple, Xiaomi mobile phone is blocked by default for all the recipients of the broadcast, you must let the user manually in the "system and Security"-"self-start management" to add your program</p></p><p style="color: rgb(54, 46, 43); font-family: Arial; font-size: 14px; line-height: 26px; white-space: normal; background-color: rgb(255, 255, 255);"><p style="color: rgb(54, 46, 43); font-family: Arial; font-size: 14px; line-height: 26px; white-space: normal; background-color: rgb(255, 255, 255);">How to tell the user to set up, simple to play a toast is the simplest way, but it is better to automatically jump to that setting interface</p></p><p style="color: rgb(54, 46, 43); font-family: Arial; font-size: 14px; line-height: 26px; white-space: normal; background-color: rgb(255, 255, 255);"><p style="color: rgb(54, 46, 43); font-family: Arial; font-size: 14px; line-height: 26px; white-space: normal; background-color: rgb(255, 255, 255);">After research</p></p><p style="color: rgb(54, 46, 43); font-family: Arial; font-size: 14px; line-height: 26px; white-space: normal; background-color: rgb(255, 255, 255);"><p style="color: rgb(54, 46, 43); font-family: Arial; font-size: 14px; line-height: 26px; white-space: normal; background-color: rgb(255, 255, 255);">This self-initiated management is not a standalone apk, it is an activity in the system setup</p></p><p style="color: rgb(54, 46, 43); font-family: Arial; font-size: 14px; line-height: 26px; white-space: normal; background-color: rgb(255, 255, 255);"><p style="color: rgb(54, 46, 43); font-family: Arial; font-size: 14px; line-height: 26px; white-space: normal; background-color: rgb(255, 255, 255);">Open the method as Follows:</p></p><p style="color: rgb(54, 46, 43); font-family: Arial; font-size: 14px; line-height: 26px; white-space: normal; background-color: rgb(255, 255, 255);"><p style="color: rgb(54, 46, 43); font-family: Arial; font-size: 14px; line-height: 26px; white-space: normal; background-color: rgb(255, 255, 255);"><br></p></p><p><p><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">Intent i =</span> <span style="margin: 0px; padding: 0px; border: none; color: rgb(0, 102, 153); font-weight: bold; background-color: inherit;">New</span> <span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">Intent (); </span></span></p></p><p><p> <span style="margin:0px; padding:0px; border:none; color:black; background-color:inherit;"> ComponentName Comp = <span style="margin:0px; padding:0px; border:none; Color:rgb (0, 102, 153); font-weight:bold; background-color:inherit; ">new </span> <span style="margin:0px; padding:0px; border:none; background-color:inherit;"> ComponentName (</span> <span style="margin:0px; padding:0px; border:none; color:blue; background-color:inherit;" "com.android.settings" < span> <span style="margin:0px; padding:0px; border:none; background-color:inherit;" , < span> </span> </span></span></p></p><p><p><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;"><span style="margin: 0px; padding: 0px; border: none; color: blue; background-color: inherit;">"com.android.settings.BackgroundApplicationsManager"</span> <span style="margin: 0px; padding: 0px; border: none; background-color: inherit;">); </span></span></p></p><p><p><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">I.setcomponent (comp);</span></p></p><p><p><span style="margin: 0px; padding: 0px; border: none; color: black; background-color: inherit;">StartActivity (i);</span></p></p><p><p><br></p></p><p><p><br></p></p><p><p> Solve the problem of the Xiaomi phone not receiving the start-up broadcast </p> </p></span>