Sunday, 15 June 2014

objective c - iOS how to change push notification title when app is running in foreground? -



objective c - iOS how to change push notification title when app is running in foreground? -

i'm using urban airship in app receive force notifications , works expected. problem when app running in foreground , force received shows notification title along info in payload.but want show title notis instead notification tried this-

- (void)application:(uiapplication *)application didreceiveremotenotification:(nsdictionary *)userinfo { if ( application.applicationstate == uiapplicationstateactive ) { nsdictionary* aps = [userinfo valueforkey:@"aps"]; uialertview* alert = [[uialertview alloc] initwithtitle:@"notis" message:[aps valueforkey:@"alert"] delegate:self cancelbuttontitle:@"ok" otherbuttontitles:nil, nil]; [alert show]; } else { uitabbarcontroller *tabbarcontroller = (uitabbarcontroller *)self.window.rootviewcontroller; tabbarcontroller.selectedindex=2; [self loadstatisticsinbackground]; [[uapush shared] handlenotification:userinfo applicationstate:application.applicationstate]; } [[uapush shared] resetbadge]; }

but shows 2 alerts 1 defined , scheme defined. help appreciated. edit: ok.. if not possible alter title of force notification there way can prevent force alert when app running in foreground?i don't want show when app running in foreground?

you can observe if app running in foreground , if does, don't pass notification uapush in -application:didreceiveremotenotification:.

ios objective-c apple-push-notifications urbanairship.com

No comments:

Post a Comment