如何以编程方式启动 PhoneStateListener?
我的应用程序中有一项活动。它包含一个按钮。通过单击按钮,应该启动 PhoneStateListener(和 BroadcastReceiver?)来捕获传入和传出呼叫。看来应该是一个服务。
有谁可以解释如何以编程方式启动 PhoneStateListener (和 BroadcastReceiver?)?
There's an activity in my application. It contains a button. By clicking the button it should be start PhoneStateListener (and BroadcastReceiver?) to catch incoming and outgoing calls. It seems it should be a service.
Does anyone can explain how to start PhoneStateListener (and BroadcastReceiver?) programmatically?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个:
Try this:
你必须使用这段代码,它是 100% 有效的。
(1) 您必须启动服务
(2) 您必须创建 CallServices 类并启动您的内容观察器。
(3 )
创建 CustomContentObserver 类来获取通话日志。
这样
你
就必须读取通话记录数据。
我正在使用内容观察者,因为在 htc 设备中无法读取phonestateListner。
you have to used this code and it is 100% work.
(1) you have to start services
(2) you have to make CallServices class and start your contentobser.
}
(3) make CustomContentObserver class to getting you to call log.
}
}
in this way you have to read call log data.
i am using content Observer because of in htc device can not read phonestateListner that's way.