简体   繁体   English

电话提示-我可以获取通话时间吗?

[英]telprompt - can I get the call duration?

I am trying to make a call through the telpromt command to return to my application after it makes a call: 我正在尝试通过telpromt命令进行调用,以在调用后返回我的应用程序:

NSString *telno = @"telprompt://121,,,,14";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:telno]];

Is there any way to calculate call duration in all situations from my app? 有什么方法可以在我的应用程序中计算所有情况下的通话时间吗?

Save a NSDate when your app is receiving the applicationWillResignActive , this will be the start of the call. 当您的应用程序收到applicationWillResignActive ,保存一个NSDate ,这将是调用的开始。 Then in the applicationDidBecomeActive calculate the difference between the saved NSDate and current date. 然后在applicationDidBecomeActive计算保存的NSDate和当前日期之间的差。 This will give you an rough estimate of the time the call lasted. 这将使您大致估计通话持续的时间。

Closer than this you will never be able to come. 比这更接近,您将永远无法来。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM