0

Is it possible to automatically start my application when device restarts? Can we use push notification to invoke the application when device restarts?

Bhagyashree
  • 169
  • 8

2 Answers2

2

For your first question no it is not possible without JailBreak, you cannot open app without user interaction, although there is an exception for VOIP-enabled app.

more info: Can iPhone apps start on start-up?

For second question yes you can open app with push notification.

more info: Open app at specified page with Push Notification

Edit:

You can get the payload from launchOptions as below:

- (BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    NSDictionary* payload = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
    if (payload) {
        // process the payload here
    }
    [window addSubview:viewController.view];
    [window makeKeyAndVisible];
    return YES;
}
Community
  • 1
  • 1
Tarek Hallak
  • 18,422
  • 7
  • 59
  • 68
  • can you explain more about how to set value to UIApplicationLaunchOptionsRemoteNotificationKey in launch options? Thanks. – Bhagyashree Oct 23 '13 at 07:29
0

Take a look at the UIBackgroundModes section in this document - it seems to state that adding the voip key will autostart an app on boot.

Try this sample code

a sample app seems to confirm this behavior.

Siddh
  • 712
  • 4
  • 21
  • This is for VOIP-enabled app, and please make sure to put reference to the Author. http://stackoverflow.com/a/9300992/1262634 – Tarek Hallak Oct 23 '13 at 06:48