【问题标题】:Samsung Glaxy S4 users report that BOOT_COMPLETED receiver won't work?三星 Galaxy S4 用户报告 BOOT_COMPLETED 接收器无法工作?
【发布时间】:2013-06-18 21:13:39
【问题描述】:

我在 Play 商店中的一个应用程序有一个 BOOT_COMPLETED 接收器,在 S4 之前它从未出现任何问题,我收到了多封来自 S4 用户的电子邮件,说该应用程序无法运行,经过一些故障排除后BOOT_COMPLETED 接收者没有被调用。

这里有人知道如何为这个特定设备解决这个问题吗?

这是它的主要代码:

public class BootCompletedIntentReceiver extends BroadcastReceiver {

@Override
public void onReceive(Context context, Intent intent) {
    if ("android.intent.action.BOOT_COMPLETED".equals(intent.getAction())) {
        ...
        ...
        //ALL MY CODE IS HERE
        ...
        ...
    }
}
}

清单:

    <receiver android:name=".BootCompletedIntentReceiver" >
        <intent-filter>
            <action android:name="android.intent.action.BOOT_COMPLETED" />
        </intent-filter>
    </receiver>

我当然有正确的权限:

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />

【问题讨论】:

  • 用户是否运行过您的活动?请记住,在手动运行应用程序组件之前,清单注册的接收器将无法在 Android 3.1+ 上工作。
  • 是的,他们做到了,他们打开了它并进行了一些我要求他们做的故障排除。所有结果都以相同的结果结束,接收器在启动时没有被调用,因此用户必须再次打开应用程序才能启用服务。
  • 你也可以看看stackoverflow.com/questions/17221679/…,我昨天和别人讨论过这种事情,以防它给你任何线索。我目前没有S4,所以我不知道关于BOOT_COMPLETED的其他细节。
  • 很有趣,会试试这个,看看我有没有东西。谢谢。
  • FWIW,我刚拿到一个 S4,我对 BOOT_COMPLETED 没有任何问题,使用这个测试项目:github.com/commonsguy/cw-omnibus/tree/master/SystemEvents/… 不过请注意,有几种设备型号作为 Galaxy S4 销售.

标签: android broadcastreceiver boot


【解决方案1】:

BOOT_COMPLETE 在挂载外部存储之前发送。如果应用程序安装到外部存储,它不会收到 BOOT_COMPLETE 广播消息。为了防止这种情况,您可以将应用程序安装在内部存储中。您只需在 menifest.xml 中添加这一行即可。

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   android:installLocation="internalOnly"
    ... >

一些 HTC 设备可以启用“快速启动”功能,该功能更像是深度休眠而不是真正的重新启动,因此不应给出 BOOT_COMPLETE 意图。要恢复它,您的接收器将如下所示:

        <receiver
            android:name="YOUR_FULL_PACKAGE_NAME.BootStartUpReciever"
            android:enabled="true"
            android:exported="true" >
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
                <action android:name="android.intent.action.QUICKBOOT_POWERON" />
            </intent-filter>
        </receiver>

此过程适用于我的 Samsung Galaxy SM-T235Y Tab4,但不适用于 Samsung GT-S7852 手机。相关Thread is here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-30
    • 2013-05-31
    • 2014-02-28
    • 1970-01-01
    相关资源
    最近更新 更多