Push Notifications

How to manage and receive push notifications with the Apps Panel iOS SDK

The Apps Panel iOS SDK provides a push module, letting you target users and send scheduled push notifications.

Integration

If you want to use push notifications in your app with the Apps Panel SDK, you need to add the following code to your AppDelegate :

- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken {
    [[AppsPanel sharedInstance] registerWithDeviceToken:deviceToken andApp:application];
}

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
    [[AppsPanel sharedInstance] didReceiveRemoteNotificationAPPSPANEL:userInfo state:[application applicationState]];
    completionHandler(UIBackgroundFetchResultNewData);
}
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    AppsPanel.sharedInstance().register(withDeviceToken: deviceToken, andApp: application)
}

func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
    AppsPanel.sharedInstance().didReceiveRemoteNotificationAPPSPANEL(userInfo, state: application.applicationState)
    completionHandler(.newData)
}

Asking for permission

In your back-office, you can set if you want an automatic permission prompt at app launch. If you set it to manual, you must call [[AppsPanel sharedInstance] registerForRemoteNotifications] where you want the push notification's permission prompt to be displayed.

Deep Linking and url management

From the Apps-Panel Back Office you can send push with url inside. To handle this case, you need to implement the following function in your AppDelegate :

- (void)managePushWithUrlString:(NSString *)urlPush;

Every URL you want to manage should be declared in the app's Info.plist. Just declare an array named APPushInternalRedirectURLs and add your urls.