通话结束后启动应用程序

发布于 2024-11-08 18:04:10 字数 87 浏览 0 评论 0原文

我正在开发一个应用程序,在其中我可以初始化来自应用程序的调用。通话结束后,是否可以返回到通话前我所在的应用程序中的同一位置?如果可以的话,如何实现呢?先感谢您。

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

一梦浮鱼 2024-11-15 18:04:10

我相信你无法做你想做的事。因为一旦用户参加呼叫并终止呼叫,当前活动的应用程序将是 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.

人│生佛魔见 2024-11-15 18:04:10

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.

玩物 2024-11-15 18:04:10

如果您想在拨打电话后返回应用程序,则需要更改

[UIApplication sharedApplication] openURL:telURL];

UIWebView PhoneCallWebView = [[UIWebView alloc] init];
[PhoneCallWebView loadRequest:[NSURLRequest requestWithURL:telURL]];

并且可以使用。

If you want to come back to your application after a phone call, need to change

[UIApplication sharedApplication] openURL:telURL];

to

UIWebView PhoneCallWebView = [[UIWebView alloc] init];
[PhoneCallWebView loadRequest:[NSURLRequest requestWithURL:telURL]];

and it works.

人心善变 2024-11-15 18:04:10

我希望这会对您有所帮助...并且这将在通话结束后在应用程序中返回。

NSString *aPhoneNo = @"9876543210";
    NSURL *url= [NSURL URLWithString:aPhoneNo];
    NSString *osVersion = [[UIDevice currentDevice] systemVersion];
    if ([osVersion floatValue] >= 3.1)
    {
        UIWebView *webview = [[UIWebView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame]; 
        [webview loadRequest:[NSURLRequest requestWithURL:url]]; 
        webview.hidden = YES; 
            // Assume we are in a view controller and have access to self.view 
        [self.view addSubview:webview]; 
        [webview release]; 
    }
    else
    {
            // On 3.0 and below, dial as usual 
        [[UIApplication sharedApplication] openURL: url];
    }

I hope this will help you...and this will back after in application after call ended.

NSString *aPhoneNo = @"9876543210";
    NSURL *url= [NSURL URLWithString:aPhoneNo];
    NSString *osVersion = [[UIDevice currentDevice] systemVersion];
    if ([osVersion floatValue] >= 3.1)
    {
        UIWebView *webview = [[UIWebView alloc] initWithFrame:[UIScreen mainScreen].applicationFrame]; 
        [webview loadRequest:[NSURLRequest requestWithURL:url]]; 
        webview.hidden = YES; 
            // Assume we are in a view controller and have access to self.view 
        [self.view addSubview:webview]; 
        [webview release]; 
    }
    else
    {
            // On 3.0 and below, dial as usual 
        [[UIApplication sharedApplication] openURL: url];
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文