Android Notifications with flag possible?

81 views Asked by At

Is it in Android possible, that I can specify some additional information on an local notification? I'm using API15. In iOS I can do it like this:

+ (void)createNotificationWithDate:(NSDate *)date withText:(NSString *)text withInfo:(NSString *)additionalInfo {
    UILocalNotification* localNotification = [[UILocalNotification alloc] init];
    localNotification.fireDate = date;
    //localNotification.alertTitle = NSLocalizedString(@"Item Due", nil);
    localNotification.alertBody = text;
    localNotification.soundName = UILocalNotificationDefaultSoundName;
    localNotification.timeZone = [NSTimeZone defaultTimeZone];
    localNotification.applicationIconBadgeNumber = [[UIApplication sharedApplication] applicationIconBadgeNumber] + 1;

    //Additional Info
    NSDictionary *info = [NSDictionary dictionaryWithObject:[NSString stringWithFormat:@"%@", additionalInfo] forKey:@"additionalInfoFlag"];
    localNotification.userInfo = info;

    [[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
}

But, how can I do this in Android?

Background is, that I want to delete in another proccess only the specific notifications with additionalInfo flag. In iOS i've got:

+ (void)deleteNotificationWithAdditionalInfo:(NSString *)additionalInfo {
    UILocalNotification * notificationToCancel = nil;

    for(UILocalNotification * aNotif in [[UIApplication sharedApplication] scheduledLocalNotifications]) {
        if([[aNotif.userInfo objectForKey:@"additionalInfo"] isEqualToString:additionalInfo ]) {
            notificationToCancel = aNotif;
            [[UIApplication sharedApplication] cancelLocalNotification:notificationToCancel];
        }
    }
}
0

There are 0 answers