【发布时间】:2013-11-21 09:30:31
【问题描述】:
我正在开发一个应用程序,我想在其中跟踪拨出电话及其持续时间。例如,如果手机用户拨打电话,我使用 Intent.ACTION_NEW_OUTGOING_CALL。*当他挂断电话时,要执行什么操作?。*我参考了所有教程,他们建议使用设备调用日志 URI。但我想在广播接收器中执行此操作。提前致谢。
public class MyCallReceiver extends BroadcastReceiver{
public void onReceive(Context context, Intent intent) {
if (intent.getAction().equals(Intent.ACTION_NEW_OUTGOING_CALL)) {
String number = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
}
}
}
【问题讨论】:
-
请发布
adb logcat输出,包括异常跟踪的引起部分。 -
@18446744073709551615 当我运行这个应用程序时,我可以得到拨打的号码。我仍然没有例外。我要求像操作拨号(ACTION_NEW_OUTGOING_CALL)一样结束通话的任何其他活动......跨度>
标签: android android-intent broadcastreceiver phone-call