I am trying to expand my current application (the company's internal phone book) to be able to forward calls through our switch. This process is called man. Then I can park the call and call another employee and call number 4 again to connect the person and colleague. But when I went through the code process in my head, I realized that this would be impossible. Because what happens is a call to Person A, I open the application and select the person. The application initiates a call, and then the application pauses in the background.
How can I start to let the application (while paused) initiate a third call to number 4 without having to reactivate the application? From my tests, I see how the application sends debugging materials, but when I try to do things like opening a browser, for example, it will fail. Is it also possible when there is an active call? Or does the call cause activity and suppress all applications?
Just hoping for some quick contribution to this, before I go ahead and spend the useless hours on it, realizing that this is not even possible.
EDIT: code examples added.
First, the user clicks a line in the contact book.
public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
{
Console.WriteLine("Initiate Call to Contact");
NSUrl url = new NSUrl("tel:" + _items.Contacts[indexPath.Row].Number);
if (!UIApplication.SharedApplication.OpenUrl(url))
{
var av = new UIAlertView("Not supported"
, "Scheme 'tel:' is not supported on this device"
, null
, "Ok thanks"
, null);
av.Show();
}
}
which will prompt the user to call this number (because afaik u cannot initiate the call without a hint?
, , ( ), 3- 4. , .
3 ( - )
public partial class AppDelegate : UIApplicationDelegate
{
int ourTask;
public override void DidEnterBackground (UIApplication application)
{
Console.WriteLine("Entered Background!");
ourTask = application.BeginBackgroundTask(delegate {
if(ourTask != 0) {
application.EndBackgroundTask(ourTask);
ourTask = 0;
}
});
new System.Action(delegate {
if(_state == 3) {
BeginInvokeOnMainThread( delegate {
Console.WriteLine("Code queued");
if(UIDevice.CurrentDevice.IsMultitaskingSupported) {
Thread.Sleep(10000);
NSUrl url = new NSUrl("tel:" + 4);
if (!UIApplication.SharedApplication.OpenUrl(url))
{
Console.WriteLine("Not supported!");
}
Console.WriteLine("Invoke Finished!");
}
application.BeginInvokeOnMainThread(delegate {
if(ourTask != 0) {
application.EndBackgroundTask(ourTask);
ourTask = 0;
Console.WriteLine("App Ended!");
}
});
});
}
}).BeginInvoke(null,null);
}
}