广播接收器有问题吗?
Hai 正在开发一个使用广播接收器获取纬度和经度值的 Android 应用程序。我的要求是始终运行广播接收器
我的问题
1.当使用广播接收器进行后台服务时,长期过程会出现任何问题。
2.在广播接收器中使用唤醒锁,是否可以休眠或停止服务?
Hai am developing a android Application using broadcast receiver to get latitude and longtitude value.My requirements is always running the broadCast reciver
My problem
1.when using broadcast receiver for back ground service is any problem for long term process.
2.am using wake lock in Broad cast receiver ,is it possible to sleep or Stop the service ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
具体来说,如果您希望广播接收器始终处于打开状态,那么您应该在清单中声明它,而不是在代码中。
1...请澄清
2...如果您的服务中有广播接收器,并向其传递消息...此通信可以正常工作。
Specifically if you want your broadcastreciever to be on at all times, then you should declare it in the manifest NOT in your code.
1... please clarify
2... if you have a broadcast reciever in your service, and pass a message to it.. this communication would work.
请在清单文件中声明您的广播接收器。所以它会一直可用...
如果您希望接收器在重新启动后也能工作,请像下面那样制作另一个接收器来唤醒您的个人广播接收器。
Please declare your broadcast receiver in the manifest file. So it will be available all the time...
And if you want your receiver to work even after the reboot then make another receiver like below to awake your personal broadcast receiver.