【发布时间】:2013-09-13 19:13:38
【问题描述】:
我一直在为 HTC Desire HD (Android 2.2) 上的客户端开发一个 android 应用程序,该应用程序利用 BOOT_COMPLETED 操作在手机启动时自动启动应用程序。这在 HTC 上运行良好。
但是,客户说,他想要运行应用程序的手机是 Alcatel onetouch|983 (Android 2.3.7)。
我已在此手机上安装了该应用程序,但是当我重新启动设备时,该应用程序无法启动。
在阿尔卡特上调试时,我可以使用 adb shell 触发 BOOT_COMPLETED 操作,接收器类可以识别该操作并触发相应的代码。但手机启动时它永远不会触发。
我的 XML 清单
<receiver android:name=".FloReceiver"
android:enabled="true" >
<intent-filter android:priority="999" >
<!-- higher priority than native messaging app -->
<action android:name="android.intent.action.USER_PRESENT" />
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
我的接收者班
public class FloReceiver extends BroadcastReceiver
{
public static final String SMS_RECEIVED ="android.provider.Telephony.SMS_RECEIVED";
public static final String BOOT_COMPLETE = "android.intent.action.BOOT_COMPLETED";
@Override
public void onReceive(Context context, Intent intent)
{
if (BOOT_COMPLETE.equals(intent.getAction()))
{
Activity_PinEntry.ShowScreenLock(context);
context.startService(new Intent(context, ReceiverService.class));
}
}
}
任何建议/帮助将不胜感激,我真的在这里摸不着头脑。
提前致谢,亚当。
【问题讨论】:
标签: android broadcastreceiver bootcompleted