通话结束后启动应用程序
我正在开发一个应用程序,在其中我可以初始化来自应用程序的调用。通话结束后,是否可以返回到通话前我所在的应用程序中的同一位置?如果可以的话,如何实现呢?先感谢您。
I am developing an application in which, I can initialize a call from the application. Is it possible to come back to the same place in the application where I was before the call, after the call is terminated? If it is possible, then how? Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我相信你无法做你想做的事。因为一旦用户参加呼叫并终止呼叫,当前活动的应用程序将是 Dialer,并且您无法让您的应用程序处于活动状态。
I believe you can not do what you are trying to do. Because once the user attends the call and terminates the call, the application currently active would be Dialer and you can not in no way make you application active.
从 UIApplicationDelegate 协议实现以下方法:
applicationWillResignActive 在手机收到来电时调用
applicationWillTerminate 在用户接听电话时调用
<如果用户选择不接听电话,则调用 applicationDidBecomeActive
applicationWillTerminate 将给予几秒钟的时间来保存应用程序的当前状态。
使用NSUserDefaults来保存状态。当应用程序再次启动时,您可以从 NSUserDefaults 读取状态并将应用程序恢复到之前的状态。
Implement the following methods from the UIApplicationDelegate protocol:
applicationWillResignActive is called when the phone receives an incoming call
applicationWillTerminate is called when the user answers the call
applicationDidBecomeActive is called if the user choose not to answer the call
applicationWillTerminate will give a few seconds to save your apps current state.
Use NSUserDefaults to save state . When the app starts again you read your state from NSUserDefaults and restore the app to its previous state.
如果您想在拨打电话后返回应用程序,则需要更改
为
并且可以使用。
If you want to come back to your application after a phone call, need to change
to
and it works.
我希望这会对您有所帮助...并且这将在通话结束后在应用程序中返回。
I hope this will help you...and this will back after in application after call ended.