Home Help Center

Moving to Background on iPhone

Hello,

1) i have looked on the "Chat" example for Ice Touch,
- (void)applicationDidEnterBackground
{
// Start the long-running task and return immediately.
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
[communicator destroy];
});
}

what Ice advise us to do when moving to Background, should we always destroy the ICE communicator?


2) i have read the VOIP example Readme note:
Note that background applications are not supported in devices before
3G, and background notifications do not work in the simulator.
is there any way to communicate with the application when it at Background using ICE ?

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    You don't necessarily have to destroy the communicator when the application is moved to the background. It isn't what the voip demo does for example. The voip demo demonstrates how to receive Ice callbacks while the application is in the background. Let us know if you need more information on this.

    Cheers,
    Benoit.
  • Hello Benoit,

    Thanks for your quick reply.

    I understand the voip example,
    unfortunately our application is not voip, audio or location.

    Let's assume the app in "background state";
    is there a way to handle "call backs"?

    If there is no such way - I guess following scenarios may take place:
    1. server that calls a client callback function will receive exception.
    2. when the app is "back" to "foreground" state, it will receive the call though server received exception
    Is it correct?
    You don't necessarily have to destroy the communicator when the application is moved to the background

    So we can continue to work with the same communicator when the app is back.
    I guess that in "chat" communicator is destroyed as a workaround - setDefaultRouter can't be called twice.
    Is it correct?

    Thanks ….
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    Yes, I believe the chat application destroys the communicator when the application goes into the background to disconnect the client from the server, when the application goes into the foreground the user is supposed to connect again to the chat server to establish a new session (with a new communicator).

    If you don't use VoIP sockets, invocations on the background iPhone application will probably hang until a timeout is reached. When the application is brought back into the foreground, it might or might not receive the request depending on whether or not it was queued by the TCP/IP stack.

    Can't you use VoIP sockets if you want to be able to receive callbacks while in the background?

    Cheers,
    Benoit.
  • Hello Benoit,

    Thanks for your quick reply.
    Can't you use VoIP sockets if you want to be able to receive callbacks while in the background?

    i don't sure i understood you, could we define our application as Voip application (to use Voip sockets) even our application only send and receive data?
    is it not a problem to put this application on App Store?

    Thanks,
    Moshe
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    Yes if the use of VoIP sockets in background applications is strictly reserved to VoIP applications, I imagine your application won't be accepted if it doesn't fall into this category and uses VoIP sockets. I'm afraid, VoIP sockets are the only option to receive Ice callbacks while the application is in the background. If you can't use them, you'll need to re-consider your design and instead of relying on callbacks for receiving information while in the background, your application could for example pull this information when it's brought back to the foreground.

    Cheers,
    Benoit.
Sign In or Register to comment.