Apple and Google limit how many times an app can show the system permission dialog. Usually, you can only trigger the native prompt once per installation.
How system permissions work
When you call the registration method for the first time, the phone displays a system dialog. If the user picks Allow, the device registers for notifications. If they pick Deny, the OS records that choice. On iOS, you cannot trigger this native window again. On Android 13 and later, the OS blocks the prompt if the user selects the option to stop asking.
Get users to enable notifications manually
To help users who changed their minds, you have to use a custom screen or popup within your app. This custom UI should explain why they should turn on notifications. If the user agrees to your custom prompt, send them to the system settings page where they can toggle the permission manually.
Open settings on iOS
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString] options:@{} completionHandler:nil];
Open settings on Android
Intent intent = new Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS);
intent.putExtra(Settings.EXTRA_APP_PACKAGE, getPackageName());
startActivity(intent);
If a user closes your custom popup without going to settings, you can save that state in local storage like NSUserDefaults or SharedPreferences. This allows you to ask them again later without bothering them on every app launch.
Comments
0 comments
Please sign in to leave a comment.