我正在尝试开发一个Android锁屏应用程序,我完成了所有的功能,除了一个。
当手机重新启动时,它会显示主屏幕,但我想显示我的锁屏应用程序,所以我添加了以下广播接收器:
<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>在onreceive()方法中,我启动了一个活动。当手机重新启动时,我的锁屏应用程序会在5-10秒后打开,但我希望在手机重新启动时显示我的应用程序。
我找不到任何解决方案。我看到许多锁屏应用程序,它们打开时最大延迟为5-10秒。
我找到了一个应用程序-- Next lock screen。它起作用了。它会在重启手机后第一次打开。
发布于 2015-11-23 21:03:16
这可以提高你的优先级,但仍然会有一些延迟。因为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>https://stackoverflow.com/questions/33870460
复制相似问题