Android:如果我重新启动设备,通知将不起作用
我已经为我的设备实现了通知。
效果很好。但如果我重新启动设备,它就根本无法工作。
那么这有什么问题吗? 我应该在清单中添加任何内容吗?
我添加了此代码来接收通知类的广播。
代码:
<!-- To receive the Alarm Notification -->
<receiver android:name=".AlarmNotificationReceiver" android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.PHONE_STATE"></action>
</intent-filter>
</receiver>
谢谢。
I have implemented the notification for my device.
It works great. But if i reboot the device it is not going to work at all.
So whats the wrong with it ?
Should i have to add anithing in manifest ?
I have added this code to receive the broadcast of notification class.
code:
<!-- To receive the Alarm Notification -->
<receiver android:name=".AlarmNotificationReceiver" android:enabled="true">
<intent-filter>
<action android:name="android.intent.action.PHONE_STATE"></action>
</intent-filter>
</receiver>
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
创建一个扩展
BroadcastReceiver
的类,并将AlarmManager
代码放入其onReceive
中,然后您可以在以下位置重新注册BroadcastReceiver
清单文件如下。还将权限添加到清单文件中。
Make a class that extends the
BroadcastReceiver
and put theAlarmManager
code in itsonReceive
then you can resgister theBroadcastReceiver
in the Manifest file as below.Also add the Permission to the Manifest File.