Handle unity native local notification

Hi there,

I m willing to write a handler for local notifications that a player taps to launch the game so it brings him to a specific context in the game. I m registering and scheduling correctly the local notifications but as far as I could do to handle local notifications (getting data from the tapped notification, maybe a string) I didn’t succeed. (I know almost nothing about Objective-c coding)

With all the research I’ve done on the internet, I came up with this (non working method) in a .mm file I added to Assets/Plugins/iOS

@implementation HandleLocalNotificationAppDelegate

- (BOOL)application : ( UIApplication *)app didFinishLaunchingWithOptions : ( NSDictionary *)launchOptions {

    UILocalNotification *localNotif =

    [launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey];

    if (localNotif) {
// Missing here a way to get data from the notification to send to unity
        NSLog(@"FROM IOS :: Received local notif");

        UnitySendMessage("Receiver", "GetNotif", "data");  

    }
    returnYES;
}

@end

Sorry for upping the thread but I’m really stuck :frowning:

Why don’t you use Unity’s local notifications? It’s fairly easy to embed user data in them which you can retrieve when a user launches the game via a notification.

I’m using unity’s local notifications but I cant rely on NotificationService.LocalNotificationCount

Why not? It seemed reliable in all the testing I did.