-
Notifications
You must be signed in to change notification settings - Fork 19
Integration via app delegate composition
Davor Komušanac edited this page Dec 5, 2022
·
15 revisions
-
Import the library:
// Swift import MobileMessaging
// Objective-C @import MobileMessaging;
-
Start MobileMessaging service using your Infobip Application Code, obtained in step 2, and preferable notification type as parameters:
// Swift func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { MobileMessaging.withApplicationCode(<#your application code#>, notificationType: <#for example MMUserNotificationType(options: [.alert, .sound])#>)?.start() ... }
// Objective-C - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { MMUserNotificationType *userNotificationType = [[MMUserNotificationType alloc] initWithOptions:<#for example @[MMUserNotificationType.alert, MMUserNotificationType.sound]#>; [[MobileMessaging withApplicationCode: <#your application code#> notificationType: userNotificationType] start:nil]; ... }
-
Override method
application:didRegisterForRemoteNotificationsWithDeviceToken:
in order to inform Infobip about the new device registered:// Swift func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) { MobileMessaging.didRegisterForRemoteNotificationsWithDeviceToken(deviceToken) }
// Objective-C - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { [MobileMessaging didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; }
-
Override method
application:didReceiveRemoteNotification:fetchCompletionHandler:
in order to send notification delivery reports to Infobip:// Swift func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject], fetchCompletionHandler completionHandler: (UIBackgroundFetchResult) -> Void) { MobileMessaging.didReceiveRemoteNotification(userInfo, fetchCompletionHandler: completionHandler) }
// Objective-C - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler { [MobileMessaging didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler]; }
-
Override method
application:didReceiveLocalNotification
(for Objective-C) orapplication:didReceive:
(for Swift 3) in order the MobileMessaging SDK to be able to handle incoming local notifications internally:// Swift func application(_ application: UIApplication, didReceive notification: UILocalNotification) { MobileMessaging.didReceiveLocalNotification(notification) }
// Objective-C -(void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification { [MobileMessaging didReceiveLocalNotification:notification]; }
If you have any questions or suggestions, feel free to send an email to [email protected] or create an issue.
- Library events
- Server errors
- Users and installations
- Messages and notifications management
- Inbox
- Geofencing service
- Privacy settings
- In-app chat
- WebRTC Calls and UI