想要使用broadcastreceiver保存拨出电话号码,持续时间 [英] Want to save the outgoing call number, duration using broadcastreceiver
本文介绍了想要使用broadcastreceiver保存拨出电话号码,持续时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨朋友
我想在android中使用broadcastreceiver服务保存拨出电话号码和持续时间。我使用下面的代码来实现功能,但它会引发错误。
请帮我解决这个问题。
Hi Friends
I want to save the outgoing call number and duration using broadcastreceiver service in android. I used the below code to achieve the functionality but it throws error.
Please help me resolve this.
public class OutgoingReceiver extends BroadcastReceiver {
public OutgoingReceiver() {
}
@Override
public void onReceive(Context context, Intent intent) {
try
{
Bundle bundle = intent.getExtras();
number = bundle.getString(Intent.EXTRA_PHONE_NUMBER);
dbOutgoing = new DBOutgoing(ctx);
dbOutgoing.InsertOutGoingCallDB(number, "0", "0");
Toast.makeText(ctx,
"Outgoing: "+number,
Toast.LENGTH_LONG).show();
}
catch(FileNotFoundException e)
{
e.printStackTrace();
Toast.makeText(ctx, String.valueOf(e),Toast.LENGTH_LONG).show();
}
}
以上代码给出拨打电话号码但我希望电话结束后的持续时间。如果可能请分享完整的代码。
提前致谢
The above code is giving the outgoing call number but i want the duration also after the call ends. Please share the full code if possible.
Thanks in advance
推荐答案
这篇关于想要使用broadcastreceiver保存拨出电话号码,持续时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文