Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to have a custom dialog message when asking for notification permissions?

Tags:

ios

I would like to customize the following part of the notification permission prompt:

Notifications may include alerts, sounds, and icon badges. These can be configured in Settings.

Is it possible to change this to my own text?

like image 430
Jason Fel Avatar asked Dec 28 '16 00:12

Jason Fel


People also ask

When should you ask for notification permissions?

Generally speaking, you should ask users for permissions only when absolutely necessary and only after ensuring that users understand how granting this access will benefit them.

What is provisional notification?

Provisional push enables publishers to send notifications to a user's device without explicitly obtaining prior permission.

What is a push permission prompt?

"Prompting" is asking user's permission to send them push notifications. Prompts are pop-up messages presented by the browser or mobile app and require the user to click "Allow" to be subscribed.


2 Answers

You are not able to customize this message. Read Here for more information.

The recommended way that most apps handle this is by first presenting their own dialog, then show the Apple system dialog.

So when it comes time to ask the user for notification permissions, first you trigger your own custom alert that says something like "Please allow your-app-name to send you notifications..." and maybe a brief description of why the user should allow this. With this alert, only add one action to the UIAlertController, I usually just have the action title set to "Ok" and use .default as the style. In the completion handler of this "Ok" UIAlertAction that is when you will trigger the Apple system dialogue which presents the generic UIAlertController with the option for the user to either accept or deny permissions for your app to send notifications.

So the flow is something like -> users reaches point in app where they have to decide if they want to accept or deny notifications permissions -> app presents UIAlertController that is essentially just an explanation of why the app wants/needs to send notifications -> once user taps "Ok" then trigger the generic system alert that actually makes the user choose to accept or deny notification permission.

There seems to be some psychological advantage to doing it this way. By sort of forcing the user to tap "ok" to notifications in the first dialogue, it primes them to tap "allow notifications" in the generic Apple dialogue displayed immediately after.

EDIT Dec 2020 - Alternatively what I see a lot of apps doing now is offering an "Accept" action and a "Maybe later" action in their custom alert. If the user taps accept, then the app displays the Apple system alert which allows the user to actually Accept/Deny notifications. If the user taps "Maybe later" then the app does NOT display Apple's system dialogue. This way the user never taps DENY on the Apple system dialogue and therefore the app is still allowed to show it in the future without having to make the user manually change the app's notification preferences via the iOS settings app.

EDIT Mar 2021 - (see @blackjacx comment) Apple has rejected (at least 1) app(s) for using a "priming" dialogue before showing the system alert. So that approach seems like it is no longer allowed.

like image 92
MikeG Avatar answered Sep 16 '22 12:09

MikeG


No, this is system message, you can't change to custom.

like image 31
SergStav Avatar answered Sep 20 '22 12:09

SergStav