我对使用Android 5.1的Mediacom X530U和Motorola Moto G设备有疑问。
我有这个清单:
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<receiver
android:name=".BootCompletedReceiver"
android:enabled="true"
android:exported="true">
<intent-filter android:priority="9999">
<action android:name="android.intent.action.BOOT_COMPLETED"/>
<action android:name="android.intent.action.QUICKBOOT_POWERON"/>
<action android:name="android.intent.action.LOCKED_BOOT_COMPLETED"/>
<action android:name="android.intent.action.REBOOT"/>
<action android:name="android.intent.action.USER_PRESENT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
</application>
这是BootCompletedReceiver代码:
public class BootCompletedReceiver extends BroadcastReceiver {
private static final String TAG = "BootCompletedReceiver";
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(context, "You see me now!!", Toast.LENGTH_SHORT).show();
Log.i(TAG, "You see me now!!");
}
}
我已经使用Android版本5,6和7的phisical和emulators设备测试了这段代码并运行良好,但是使用Mediacom X530U和Motorola Moto G设备BOOT_COMPLETED似乎无效。
我尝试使用whatsapp等其他应用程序启动时检查设备问题,并在启动时启动whatsapp。
我已经通过恢复出厂设置重置设备,但没有任何变化。
这是设备启动后的日志,在这种情况下,我使用的是Mediacom X530U
12-12 11:32:08.449 1538-1538/? I/VoiceCommandApp/BootCompletedReceiver: [BootCompletedReceiver]new...
12-12 11:32:13.305 1561-1561/? D/ActivityThread: BDC-Calling onReceive: intent=Intent { act=android.intent.action.SIM_STATE_CHANGED flg=0x4000010 cmp=com.android.stk/.BootCompletedReceiver (has extras) }, receiver=com.android.stk.BootCompletedReceiver@261f95ea
12-12 11:32:13.311 1561-1561/? D/ActivityThread: BDC-RECEIVER handled : 0 / ReceiverData{intent=Intent { act=android.intent.action.SIM_STATE_CHANGED flg=0x4000010 cmp=com.android.stk/.BootCompletedReceiver (has extras) } packageName=com.android.stk resultCode=0 resultData=null resultExtras=null}
12-12 11:32:14.389 755-787/? I/ActivityManagerAR: remove Intent=Intent { act=android.intent.action.BOOT_COMPLETED flg=0x8000010 (has extras) } receiver=ResolveInfo{1b2b95b9 com.example.mdonatello.bootstart/.BootCompletedReceiver p=9999 m=0x108000} for User App
12-12 11:32:14.389 755-787/? I/ActivityManagerAR: remove Intent=Intent { act=android.intent.action.BOOT_COMPLETED flg=0x8000010 (has extras) } receiver=ResolveInfo{1f434dfe com.teleniasoftware.android.mcsclient/.receiver.BootCompletedReceiver p=9999 m=0x108000} for User App
12-12 11:32:14.571 1561-1561/? D/ActivityThread: BDC-Calling onReceive: intent=Intent { act=android.intent.action.SIM_STATE_CHANGED flg=0x4000010 cmp=com.android.stk/.BootCompletedReceiver (has extras) }, receiver=com.android.stk.BootCompletedReceiver@1aa62689
12-12 11:32:14.572 1561-1561/? D/ActivityThread: BDC-RECEIVER handled : 0 / ReceiverData{intent=Intent { act=android.intent.action.SIM_STATE_CHANGED flg=0x4000010 cmp=com.android.stk/.BootCompletedReceiver (has extras) } packageName=com.android.stk resultCode=0 resultData=null resultExtras=null}
12-12 11:32:15.748 1561-1561/? D/ActivityThread: BDC-Calling onReceive: intent=Intent { act=android.intent.action.SIM_STATE_CHANGED flg=0x4000010 cmp=com.android.stk/.BootCompletedReceiver (has extras) }, receiver=com.android.stk.BootCompletedReceiver@29e24eaf
12-12 11:32:15.750 1561-1561/? D/ActivityThread: BDC-RECEIVER handled : 0 / ReceiverData{intent=Intent { act=android.intent.action.SIM_STATE_CHANGED flg=0x4000010 cmp=com.android.stk/.BootCompletedReceiver (has extras) } packageName=com.android.stk resultCode=0 resultData=null resultExtras=null}
12-12 11:32:15.880 1561-1561/? D/ActivityThread: BDC-Calling onReceive: intent=Intent { act=android.intent.action.SIM_STATE_CHANGED flg=0x4000010 cmp=com.android.stk/.BootCompletedReceiver (has extras) }, receiver=com.android.stk.BootCompletedReceiver@dc1a245
12-12 11:32:15.882 1561-1561/? D/ActivityThread: BDC-RECEIVER handled : 0 / ReceiverData{intent=Intent { act=android.intent.action.SIM_STATE_CHANGED flg=0x4000010 cmp=com.android.stk/.BootCompletedReceiver (has extras) } packageName=com.android.stk resultCode=0 resultData=null resultExtras=null}
12-12 11:32:17.647 755-2498/? W/ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.sendBroadcast:1466 com.mediatek.search.SearchEngineManagerService.broadcastSearchEngineChangedInternal:199 com.mediatek.search.SearchEngineManagerService.initSearchEngines:182 com.mediatek.search.SearchEngineManagerService.access$100:78 com.mediatek.search.SearchEngineManagerService$BootCompletedReceiver$1.run:124
12-12 11:32:17.648 1538-1538/? I/VoiceCommandApp/BootCompletedReceiver: [onReceive]...
12-12 11:32:17.648 1538-1538/? I/VoiceCommandApp/BootCompletedReceiver: [registerObserver]...
12-12 11:32:17.651 1538-1538/? I/VoiceCommandApp/BootCompletedReceiver: [registerObserver]register contacts.
12-12 11:32:18.834 1561-1561/? D/ActivityThread: BDC-Calling onReceive: intent=Intent { act=android.intent.action.BOOT_COMPLETED flg=0x8000010 cmp=com.android.stk/.BootCompletedReceiver (has extras) }, receiver=com.android.stk.BootCompletedReceiver@21414d9a
12-12 11:32:18.849 1561-1561/? D/ActivityThread: BDC-RECEIVER handled : 0 / ReceiverData{intent=Intent { act=android.intent.action.BOOT_COMPLETED flg=0x8000010 cmp=com.android.stk/.BootCompletedReceiver (has extras) } packageName=com.android.stk resultCode=0 resultData=null resultExtras=null}
12-12 11:32:21.366 755-1220/? I/ActivityManager: Start proc 3169:com.android.vending/u0a16 for broadcast com.android.vending/com.google.android.finsky.boothandler.BootCompletedReceiver
12-12 11:32:22.058 3169-3169/? D/ActivityThread: BDC-Calling onReceive: intent=Intent { act=android.intent.action.BOOT_COMPLETED flg=0x8000010 cmp=com.android.vending/com.google.android.finsky.boothandler.BootCompletedReceiver (has extras) }, receiver=com.google.android.finsky.boothandler.BootCompletedReceiver@1f31e123
12-12 11:32:22.081 3169-3169/? D/ActivityThread: BDC-RECEIVER handled : 0 / ReceiverData{intent=Intent { act=android.intent.action.BOOT_COMPLETED flg=0x8000010 cmp=com.android.vending/com.google.android.finsky.boothandler.BootCompletedReceiver (has extras) } packageName=com.android.vending resultCode=0 resultData=null resultExtras=null}
12-12 11:32:24.330 755-775/? I/ActivityManagerAR: remove Intent=Intent { act=android.intent.action.USER_PRESENT flg=0x24000010 } receiver=ResolveInfo{3b3ab846 com.example.mdonatello.bootstart/.BootCompletedReceiver p=9999 m=0x108000} for User App
12-12 11:32:24.330 755-775/? I/ActivityManagerAR: remove Intent=Intent { act=android.intent.action.USER_PRESENT flg=0x24000010 } receiver=ResolveInfo{2849fa07 com.teleniasoftware.android.mcsclient/.receiver.BootCompletedReceiver p=9999 m=0x108000} for User App
但是我没有看到我的日志&#34;你现在看到我了!&#34;来自我的接收者。
任何人都知道这件事吗?