Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable opening app when user tap push notification

I want to keep the app from opening when user taps a push notification. How can I do this?

Here's what I have:

- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

    NSDictionary *notification = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
    if (notification != NULL){
            // write code something like doesn't open app.
     }
}
like image 629
nobinobiru Avatar asked Sep 19 '14 02:09

nobinobiru


2 Answers

It is not possible.We get control at our side after launching the app.

like image 79
Dheeraj Kumar Avatar answered Sep 23 '22 16:09

Dheeraj Kumar


@dheeraj-kumar is right.

  1. You can't prevent the app from opening, it's up to the OS
  2. Trying to prevent an app from opening is almost certainly against Apple guidelines and is very likely to result in your app getting rejected
  3. Why would you want to prevent a user from opening your app through a push notification? The reason you sent them the notification to begin with was so they know they need to check something in the app, isn't it?
like image 31
rebello95 Avatar answered Sep 21 '22 16:09

rebello95