4

好吧,我在 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" />
4

1 回答 1

0

在挂载外部存储之前发送 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>

此过程适用于我的三星 Galaxy SM-T235Y Tab4 ,但不适用于三星 GT-S7852手机。相关主题在这里

于 2015-10-04T20:50:51.080 回答