【问题标题】:BOOT_COMPLETED action works on one device but not anotherBOOT_COMPLETED 操作适用于一台设备,但不适用于另一台设备
【发布时间】: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


    【解决方案1】:

    我遇到了同样的问题。我通过将应用程序转移到手机而不是 SD 存储卡来解决它。即使您将安装目录定义为电话,阿尔卡特总是将应用程序安装到 SD 卡中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-02-12
      • 1970-01-01
      • 2012-09-05
      • 1970-01-01
      • 2019-10-22
      • 1970-01-01
      • 2012-11-01
      相关资源
      最近更新 更多