Swa*_*ati 5 android calllog android-emulator telephonymanager
我用这个:
public void onCallStateChanged(int state, String incomingNumber)
Run Code Online (Sandbox Code Playgroud)
正在听:
telephonyManager.listen(listener,PhoneStateListener.LISTEN_CALL_STATE);
Run Code Online (Sandbox Code Playgroud)
我想知道传出和传入呼叫,但是现在我只接听来电(当状态变化振铃时).任何人都可以告诉我什么时候可以检测到拨出电话及其结束
还有一种方法可以模拟Eclipse模拟器中的传出调用.能够通过eclipse中的模拟器控制为来电做到这一点.
sus*_*ush 13
使用带有意图android.intent.action.NEW_OUTGOING_CALL字符串参数的广播监听器,IntentFilter并且不要忘记在AndroidMenifest中授予权限PROCESS_OUTGOING_CALLS.这会奏效.每当有拨出呼叫时,将显示Toast消息.代码如下.
public static final String outgoing = "android.intent.action.NEW_OUTGOING_CALL" ;
IntentFilter intentFilter = new IntentFilter(outgoing);
BroadcastReceiver OutGoingCallReceiver = new BroadcastReceiver()
{
@Override
public void onReceive(Context context, Intent intent)
{
// TODO Auto-generated method stub
String outgoingno = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
Toast.makeText(context, "outgoingnum =" + outgoingno,Toast.LENGTH_LONG).show();
}
};
registerReceiver(brForOutgoingCall, intentFilter);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5122 次 |
| 最近记录: |