During Option 1 - Automated Integration In iOS App of auto integration of Mapp SDK is chosen 2.2 option, then the developer can trigger alert dialog for notification permission whenever he wants.
iOS
Objective-C
[[Appoxee shared] showNotificationAlertDialog]; |
|
Appoxee.shared()?.showNotificationAlertDialog() |
|
The ability to postpone the prompt to the user to opt-in to notifications.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[Appoxee shared] setPostponeNotificationRequest:YES]; // call this method, prior to any Appoxee call, to not show the approve notifications alert by the operating system.
[[Appoxee shared] engageAndAutoIntegrateWithLaunchOptions:launchOptions andDelegate:nil];
return YES;
} |
|
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
Appoxee.shared()?.postponeNotificationRequest = true // call this method, prior to any Appoxee call, to not show the approve notifications alert by the operating system.
Appoxee.shared()?.engageAndAutoIntegrateWithLaunchOptions(launchOptions, andDelegate: nil)
return true
} |
|
To request notifications permissions, callĀ setPostponeNotificationRequest:NO
- (IBACTION)userWantsToBeNotifiedByPushNotifications
{
[[Appoxee shared] setPostponeNotificationRequest:NO];
} |
|
func userWantsToBeNotifiedByPushNotifications() {
Appoxee.shared()?.postponeNotificationRequest = false
} |
|
Android
For Android 13 and newer it is required to request runtime permission POST_NOTIFICATION to be able to display notification UI.
Appoxee.instance().requestNotificationsPermission(MainActivity.this, results -> {
if (results.containsKey(Manifest.permission.POST_NOTIFICATIONS) &&
results.get(Manifest.permission.POST_NOTIFICATIONS) == PermissionsManager.PERMISSION_GRANTED) {
// Handle event when POST_NOTIFICATION granted
Toast.makeText(MainActivity.this,"POST NOTIFICATIONS GRANTED!", Toast.LENGTH_SHORT).show();
}
}); |
|