When the app is launched by opening a notification, the launchOptions
given by iOS to the function didFinishLaunchingWithOptions
does have the notification object but that dictionary never gets passed around to the native module through RCTBridge. Is there a way to get the launchOptions
in the native module? or am I missing something here?
My AppDelegate didFinishLaunchingWithOptions
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [FIRApp configure]; [FIRMessaging messaging].delegate = self; NSURL *jsCodeLocation; jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation moduleName:@"myModuleName" initialProperties:nil launchOptions:launchOptions]; rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; UIViewController *rootViewController = [UIViewController new]; rootViewController.view = rootView; self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible]; return YES;}
Code in my Module in Swift to get launchOptions
// launchOptions is always nillet notification: Any = self.bridge.launchOptions?[UIApplication.LaunchOptionsKey.remoteNotification] as Any;