实施例: - 我在最小化状态下生成了4种本地通知,其中包含4种类型。
以下通知类型。
消息
朋友请求
视频通话
音频电话
通知显示在通知中心。
Noow ..我点击了第二次通知,
如何点击通知的数量?
如何获得第二通知机构警报文本(内容)?
this mehod is not working for minimize state
就像whatsApp ..我需要根据通知类型进入特定的屏幕。
SELECT ENB.SAP_ID AS SAP_ID,
CAND.CANDIDATEID AS CANDIDATE_ID,
ENB.R4G_STATE AS STATE,
ENB.SITE_TYPE AS SITE_TYPE,
CAND.SITENAME AS SITE_NAME,
CAND.STATUS AS CANDIDATESTATUS,
ENB.SITEID AS SITEID,
ENB.PRIORITY_SITE AS PRIORITYSITE,
ENB.CIRCLE AS CIRCLE,
DECODE (VTS.STATUS_NAME, null, 'Fill Vendor Survey form', VTS.STATUS_NAME) AS STATUS_NAME,
ENB.LATITUDE,
ENB.LONGITUDE,
VTS.STATUS_ID,
VT.VSAT_DETAIL_ID
FROM R4G_OSP.ENODEB ENB
INNER JOIN R4G_OSP.CANDIDATE CAND ON ENB.SAP_ID = CAND.SAP_ID
LEFT JOIN TBL_VSAT_MST_DETAIL VT ON ENB.SAP_ID = VT.SAP_ID
LEFT JOIN TBL_VSAT_STATUS_MST VTS ON VT.STATUS_ID = VTS.STATUS_ID
WHERE ENB.SCOPE = 'EnodeB-Connected_MW'
AND ENB.SITEBACKHAUL = 'MW'
AND CAND.STATUS = 'Fill Vendor Survey Form'
AND (UPPER(STATE) IN (SELECT REGEXP_SUBSTR(UPPER('Bihar'),'[^,]+', 1, LEVEL) AS RFIELDS
FROM DUAL
CONNECT BY REGEXP_SUBSTR(UPPER('Bihar'), '[^,]+', 1, LEVEL) IS NOT NULL)
AND (VT.STATUS_ID IS NULL OR VT.STATUS_ID = 4));
我正在创建- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(NSString *)type {
NSString *Notitype=@"";
if ([[payload.dictionaryPayload valueForKey:@"type"]isEqualToString:@"video"]) {
Notitype=@"video";
}
else if ([[payload.dictionaryPayload valueForKey:@"type"]isEqualToString:@"friendRequest"]) {
Notitype=@"friend Request";
}
else if([[payload.dictionaryPayload valueForKey:@"type"] isEqualToString:@"message"] )
{
Notitype=@"message";
}
else{
Notitype=@"audio";
}
,如下所示:
UILocalNotification
答案 0 :(得分:0)
将本地通知设置为:
// Schedule the notification
UILocalNotification *notification = [[UILocalNotification alloc]init];
notification.repeatInterval = NSDayCalendarUnit;
[notification setAlertBody:Notitype];
[notification setFireDate:[NSDate dateWithTimeIntervalSinceNow:1]];
[notification setTimeZone:[NSTimeZone defaultTimeZone]];
//Create user info for local notification.
NSDictionary* dict = @{@"Type": @"message", @"ID": @"set your unique ID", @"body": notification.alertBody,};
notification.userInfo = dict;
//You can Set Type as: message, friend Request, video call, Audio call.
[[UIApplication sharedApplication] setScheduledLocalNotifications:[NSArray arrayWithObject:notification]];
获取点击哪种类型的本地通知,而不是使用didReceiveLocalNotification
委托。
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {
//[super application:application didReceiveLocalNotification:notification]; // In most case, you don't need this line
//Get notification type
NSString *notificationType = [notification.userInfo valueForKey:@"Type"];
//notificationType as: message, friend Request, video call, Audio call.
NSString *notificationBody = [notification.userInfo valueForKey:@"Notification_body"];
UIApplicationState state = [application applicationState];
if (state == UIApplicationStateActive) {
// Application in foreground when notification is delivered.
if ([notificationType isEqual:@"message"]) {
//Handle message
} else if ([notificationType isEqual:@"friend Request"]) {
//Handle friend Request
} else if ([notificationType isEqual:@"video call"]) {
//Handle video call
} else if ([notificationType isEqual:@"Audio call"]) {
//Handle Audio call
}
} else if (state == UIApplicationStateBackground) {
// Application was in the background when notification was delivered.
if ([notificationType isEqual:@"message"]) {
//Handle message
} else if ([notificationType isEqual:@"friend Request"]) {
//Handle friend Request
} else if ([notificationType isEqual:@"video call"]) {
//Handle video call
} else if ([notificationType isEqual:@"Audio call"]) {
//Handle Audio call
}
} else {
}
}
<强>更新强>
同样在DidFinishLaunchingWithOptions
中检查相同的内容,可能的用户不会对通知作出反应,而是点击应用图标打开应用。因此,如果是视频通话或任何紧急情况,则必须通过DidFinishLaunchingWithOptions