Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable UrbanAirship alerts

I want to ignore push notifications when the app is active. I am handling notifications as follows:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{ 
    if (application.applicationState != UIApplicationStateActive)
    {
        [[PushHelper shared] processPush: userInfo];
    }
}

But when app is active and device receives push notification, the UIAlertView with notification message appears. How can I disable default handling from UA?

like image 290
scholl Avatar asked Mar 23 '23 14:03

scholl


1 Answers

I had the same problem and found solution. If define the delegate method displayNotificationAlert: of UAPushNotificationDelegate protocol with empty body, for example, then the automatic alerts will not be shown:

{   
   ...
   [[UAPush shared] registerForRemoteNotifications];
   [UAPush shared].pushNotificationDelegate = self;
   ...
}

- (void)displayNotificationAlert:(NSString *)alertMessage
{
}
like image 143
SoVa_ Avatar answered Apr 28 '23 05:04

SoVa_