在 Android 应用程序中匹配联系人号码
有一个 Android 应用程序,可以打印弹出的 toast,并用 tts 读出收到的消息。我使用“String origin = smsMessage[0].getOriginatingAddress();”获取发件人的电话号码。
我想查询手机上的联系人列表,因此如果收到的号码与任何联系人匹配,它将打印并显示而是读出发件人的姓名。否则,如果该号码无法识别,它将默认返回仅打印&读取 OriginatingAddress 号码。 我查看了 如何查询 Android基于电话号码联系? - 但不太确定如何去做。
Have an android app that prints with a toast pop up, and reads out a received message with tts. I use "String origin = smsMessage[0].getOriginatingAddress();" to get the phone number of the sender.
I want to query the contacts list on the phone, so if the received number matches any contacts, it will print & read out the name of the sender instead. Otherwise, if the number is not recognised, it will default back to just printing & reading the OriginatingAddress number.
Iv'e looked at How can I query Android contact based on a phone number? - but not quite sure howto go about it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最终还是走这个吧
Go this eventually.
这个问题已经有了答案并发布了代码。
That question had the answer and posted the code.