如何在电话管理器中查找拨出号码
我正在使用这个:
public void onCallStateChanged(int state, String incomingNumber)
正在监听:
telephonyManager.listen(listener,PhoneStateListener.LISTEN_CALL_STATE);
我想知道拨出和拨入呼叫,但现在我只接到拨入呼叫(当状态更改正在响铃时)。谁能告诉我什么时候可以检测到拨出呼叫及其结束
还有一种方法可以在 Eclipse 模拟器中模拟拨出呼叫。能够通过 Eclipse 中的模拟器控制来对传入呼叫执行此操作。
I am using this:
public void onCallStateChanged(int state, String incomingNumber)
which is listening to:
telephonyManager.listen(listener,PhoneStateListener.LISTEN_CALL_STATE);
I want to know both outgoing and incoming calls but for now I only get incoming calls (when state changes is ringing). Can anyone tell me when can I detect outgoing call and its end
Also is there a way to simulate outgoing calls in Eclipse emulator. was able to do that for incoming calls via emulator control in eclipse.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用带有 IntentFilter 意图
android.intent.action.NEW_OUTGOING_CALL
字符串参数的广播侦听器,并且不要忘记在 AndroidMenifest 中向PROCESS_OUTGOING_CALLS
授予权限代码>.这会起作用。每当有拨出电话时,都会显示一条 toast 消息。代码如下。Use a broadcast listener with an intent
android.intent.action.NEW_OUTGOING_CALL
string parametrer for theIntentFilter
and don't forget to give permission in AndroidMenifest toPROCESS_OUTGOING_CALLS
. This will work. Whenever there is an outgoing call a toast message will be shown. Code is below.创建一个新类,例如 MyPhoneReceiver,从 BroadcastReceiver 扩展它,并实现 onReceive 方法。
在另一个类中,比如说 onCreate 方法中的 MainActivity.class 。例如。
在 AndroidManifest.xml
和 AndroidManifest.xml 中,添加:
Create a new class, let say MyPhoneReceiver, extends it from BroadcastReceiver, and implement onReceive method.
In another class, let say, MainActivity.class inside onCreate method. for example.
In the AndroidManifest.xml
and also in the AndroidManifest.xml, add: