手机重新启动时Android锁定屏幕

手机重新启动时Android锁定屏幕,android,Android,我正在尝试开发一个安卓锁屏应用程序,我完成了除一个以外的所有功能 当手机重新启动时,它会显示主屏幕,但我想显示我的锁屏应用程序,因此我添加了以下广播接收器: <receiver android:enabled="true" android:name="receiver.LockScreenReceiver"> <intent-filter android:priority="999"> <action android:name="androi

我正在尝试开发一个安卓锁屏应用程序,我完成了除一个以外的所有功能

当手机重新启动时,它会显示主屏幕,但我想显示我的锁屏应用程序,因此我添加了以下广播接收器:

<receiver android:enabled="true" android:name="receiver.LockScreenReceiver">
    <intent-filter android:priority="999">
        <action android:name="android.intent.action.BOOT_COMPLETED"/>
        <action android:name="com.htc.intent.action.QUICKBOOT_POWERON"/>
        <action android:name="android.intent.action.MY_PACKAGE_REPLACED"/>
    </intent-filter>
</receiver>


. 它起作用了。它在重新启动手机后第一次打开。

这可以提高您的优先级,但仍会有一些延迟。自从android第一次加载其操作系统和所有其他活动开始

<receiver
    android:name="receiver.LockScreenReceiver"
    android:enabled="true"
    android:exported="true"
    <intent-filter android:priority="1000">
        <action android:name="android.intent.action.BOOT_COMPLETED" />
    </intent-filter>
</receiver>

接收器很好,但该接收器的实现在哪里?@Override public void onReceive(上下文上下文,意图Intent){if(Intent.getAction().equals(Intent.ACTION_SCREEN_OFF)| Intent.getAction().equals(Intent.ACTION_SCREEN|ON)| Intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)){start_锁屏(上下文);}//Display lockscreen private void start_lockscreen(上下文上下文){Intent Minent=new Intent(上下文,LockScreenActivity.class);Minent.addFlags(Intent.FLAG_ACTIVITY_new_TASK);context.startActivity(Minent);}根据android文档优先级范围为0-999