Autostart (BOOT_COMPLETED) does not work on the Nomi tablet

独自空忆成欢 提交于 2019-12-08 03:22:17

问题


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();    
        }
    }
}

回答1:


I realized that the problem is not in the code, but the device itself. Autoplay not working on my tablet for any application. As a workaround I have used the event "android.intent.action.USER_PRESENT", which is triggered after the device loading and screen unlocking.




回答2:


<action android:name="android.intent.action.QUICKBOOT_POWERON" />

its working fine for me.if its lenovo mobile you should wait at least 2 minutes then it will open automatically.



来源:https://stackoverflow.com/questions/39945483/autostart-boot-completed-does-not-work-on-the-nomi-tablet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!