三星Galaxy S4用户报告BOOT_COMPLETED接收器无法正常工作?

时间:2013-06-21 16:44:15

标签: android broadcastreceiver boot

我在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" />

1 个答案:

答案 0 :(得分:0)

BOOT_COMPLETE在安装外部存储之前发送。如果应用程序安装到外部存储器,它将无法接收BOOT_COMPLETE广播消息。为防止这种情况,您可以在内部存储中安装应用程序。你可以在menifest.xml中添加这一行。

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

某些HTC设备可以启用快速启动&#34;功能更像是深度休眠,而不是真正的重启,因此不应该给出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>

此过程适用于我的三星Galaxy SM-T235Y Tab4 但尚未使用 Samsung GT-S7852 手机。相关Thread is here