检查是否已读取新短信
我正在为 HTC EVO 开发一个简单的应用程序,当收到新的短信时,它会闪烁备用通知 LED。我让这部分通过广播接收器工作得很好,但是当用户使用默认短信应用程序阅读消息时,我需要某种方法来关闭 LED。我不确定最好在接收器中还是在后台服务中执行此操作。我发现这个,这可能是什么我正在寻找,但我不知道如何使用它,因为我找不到任何说明或教程。
I am working on a simple app for the HTC EVO that blinks the alternate notification LED when a new text message is received. I have this part working great via a Broadcast Receiver but I need some way to turn the LED off when the user has read the message(s) using their default SMS app. I'm not sure if it is best to do this in the receiver or in a background service. I found this, which might be what I am looking for, but I have no idea on how to use it as I could not find any instructions or tutorials.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,我已经编写了以下代码,我认为它可以满足我的需求。
}
Alright, I have worked out the following code which I think will meet my needs.
}
不幸的是,我不相信有办法做到这一点。
当您的
BroadcastReceiver
收到Intent
时,它是Intent
的副本,与默认短信应用程序相同。因此,你们每个人都拥有彼此独立的消息副本。您可以设置自己的消息副本来阅读,但您将无法在默认短信应用程序中查看其状态。此外,默认应用程序不会发送消息已被读取的广播,所有数据都保存在本地。
实现这一点的唯一方法是编写消息应用程序的完整替代品。
抱歉,希望这对您有所帮助,如果您还有其他问题,请告诉我。
Unfortunately I do not believe there is a way to do this.
When your
BroadcastReceiver
receives theIntent
it is a copy of theIntent
, same with the default SMS app. So you each have copies of the message independent of eachother.You can set your own copy of the message to read, but you will be unable to see its status in the default SMS app. Also, the default app does not send out a broadcast that the message has been read, all that data is kept locally.
The only way you would be able to implement this would be to write a full replacement of the Messaging app.
Sorry, I hope this helps, let me know if you have any other questions.