手机重启后接近警报不工作 [英] Proximity Alerts not working after phone reboot

查看:146
本文介绍了手机重启后接近警报不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序之一使用接近警报,但它似乎每当我重置我的电话(通过电池拉),或只是一般,接近警报都不再有效。

I am using proximity alerts in one of my applications, however it seems that whenever I reset my phone (via battery pull) or just in general, the proximity alerts are no longer active.

他们再次合作的唯一方法是,如果我取消,并重新检查复选框(删除,然后重新添加接近警报)

The only way they work once again is if I uncheck and recheck the checkbox (which removes, then re-adds the proximity alert)

任何想法的或理性?

推荐答案

您必须重置警报。重新启动时,Android操作系统不会保留你的提醒,这是给你的应用程序。创建一个BroadcastReceiver(我叫雷BootReceiver下面的示例所示)来处理android.intent.action.BOOT_COMPLETED操作(这是在清单中定义)。随着广播接收器就可以重新启动所有的警报。不要忘了添加android.permission.RECEIVE_BOOT_COMPLETED权限。

You must reset the alerts. The Android OS does not persist your alerts when rebooting, that's up to your app. Create a BroadcastReceiver (I called mine BootReceiver in my example below) to handle the "android.intent.action.BOOT_COMPLETED" action (this is defined in the manifest). With the BroadcastReceiver you can then restart all of your alerts. Don't forget to add the "android.permission.RECEIVE_BOOT_COMPLETED" permission.

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
...
<receiver android:name=".BootReceiver">
<intent-filter>
    <action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>

这篇关于手机重启后接近警报不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆