My broadcast receiver triggered by event BOOT_COMPLETED and works fine on many devices except Nomi C10103. The message appears in the log on the device: D/ActivityManager: send broadcast: android.intent.action.BOOT_COMPLETED, skip package: com.example.myPackageName
Sending message am broadcast -a android.intent.action.BOOT_COMPLETED com.example.myPackageName from adb shell also does not run the application.
Manifest code:
<receiver
android:name=".AutoRunReceiver">
<intent-filter android:priority="1000">
<action android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<intent-filter android:priority="1000">
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
</intent-filter>
</receiver>
AutorunReceiver.java:
public class AutoRunReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
//приёмник автозагрузки
if (intent != null && intent.getAction() != null) {
final String msg="intent:"+intent+" action:"+intent.getAction();
Log.d("myLogs",msg);
Toast.makeText(context,msg,Toast.LENGTH_LONG).show();
}
}
}
答案 0 :(得分:3)
我意识到问题不在于代码,而在于设备本身。任何应用程序都无法在我的平板电脑上运行自动播放作为一种解决方法,我使用了事件“android.intent.action.USER_PRESENT”,这是在设备加载和屏幕解锁后触发的。
答案 1 :(得分:0)
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
它对我来说很好用。如果它的lenovo移动设备您应该等待至少2分钟,然后它将自动打开。