ios - How can I show a custom Local notification View or an Custom Alert view when app is in Background? -


actually want show local notification in app. want show notification custom design ok , cancel button on it.and on click of ok , cancel want perform actions.please suggest something.

thanks in advance.

i impliment code custom local notification may helping accept identifier in delegates of local notification in appdelegate.m

    nsstring *idetnt = @"accept";     nsstring *idetnt1 = @"reject";     nsstring *idetnt2 = @"local notification";     uimutableusernotificationaction *notificationaction1 = [[uimutableusernotificationaction alloc] init];     notificationaction1.identifier = idetnt;     notificationaction1.title = @"snooze";     notificationaction1.activationmode = uiusernotificationactivationmodebackground;     notificationaction1.destructive = no;     notificationaction1.authenticationrequired = no;      uimutableusernotificationaction *notificationaction2 = [[uimutableusernotificationaction alloc] init];     notificationaction2.identifier = idetnt1;     notificationaction2.title = @"call";     notificationaction2.activationmode = uiusernotificationactivationmodebackground;     notificationaction2.destructive = yes;     notificationaction2.authenticationrequired = yes;      uimutableusernotificationaction *notificationaction3 = [[uimutableusernotificationaction alloc] init];     notificationaction3.identifier = @"reply";     notificationaction3.title = @"reply";     notificationaction3.activationmode = uiusernotificationactivationmodeforeground;     notificationaction3.destructive = no;     notificationaction3.authenticationrequired = yes;      uimutableusernotificationcategory *notificationcategory = [[uimutableusernotificationcategory alloc] init];     notificationcategory.identifier = @"email";     [notificationcategory setactions:@[notificationaction1,notificationaction2,notificationaction3] forcontext:uiusernotificationactioncontextdefault];     [notificationcategory setactions:@[notificationaction1,notificationaction2] forcontext:uiusernotificationactioncontextminimal];      nsset *categories = [nsset setwithobjects:notificationcategory, nil];     uiusernotificationtype notificationtype = uiusernotificationtypebadge | uiusernotificationtypesound | uiusernotificationtypealert;     uiusernotificationsettings *notificationsettings = [uiusernotificationsettings settingsfortypes:notificationtype categories:categories];     [[uiapplication sharedapplication] registerusernotificationsettings:notificationsettings];     uilocalnotification* localnotification = [[uilocalnotification alloc] init];     localnotification.firedate = [nsdate datewithtimeintervalsincenow:600];     localnotification.alertbody = idetnt2;     localnotification.category = @"email";     [[uiapplication sharedapplication] schedulelocalnotification:localnotification]; 

when ur app in background methods call

- (void)application:(uiapplication *)application handleactionwithidentifier:(nsstring *)identifier forlocalnotification:(uilocalnotification *)notification completionhandler:(void(^)())completionhandler {     if ([identifier isequaltostring:@"accept"])    {    }    else if ([identifier isequaltostring:@"reject"])    {    }    else if ([identifier isequaltostring:@"reply"])    {     }    if(completionhandler != nil)     completionhandler();  } 

when ur app in foreground methods call

- (void)application:(uiapplication *)app didreceivelocalnotification:(uilocalnotification *)localnotification { } 

go capability option , click on remote notificationenter image description here


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -