DEV Community

Cover image for How to Change iOS Push Notifications Permission Dialog with Expo
Vladimir Vovk
Vladimir Vovk

Posted on

How to Change iOS Push Notifications Permission Dialog with Expo

To receive push notifications we need to ask the user permission first. The requestPermissionsAsync function will show the user standard dialog asking to allow displaying alerts, setting badge count, and playing sounds.

Standard iOS permission dialog

Unfortunately, the docs have no information on how to change the dialog's text and make it more personal for our app. I found this Apple Developer Forums thread which recommends setting the NSUserNotificationsUsageDescription key in the Info.plist file.

For React Native app we can easily do that with XCode. And for the Expo app, we can set it with app.json or app.config.js configuration files.

All we need to do is to go to the ios -> infoPlist section of the configuration file and add NSUserNotificationsUsageDescription key like so:

{
  "name": "My awesome app",
  "ios": {
    "infoPlist": {
      "NSUserNotificationsUsageDescription": "Allow notifications to stay up to date. These can be configured from the System Settings."
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

That's it! πŸŽ‰
Rebuild your app binary and enjoy your new permission text.


If this post was helpful to you please, give it a star 🌟, and happy hacking! πŸ’»

Credits

Photo by Adem AY on Unsplash

Image of Datadog

The Future of AI, LLMs, and Observability on Google Cloud

Datadog sat down with Google’s Director of AI to discuss the current and future states of AI, ML, and LLMs on Google Cloud. Discover 7 key insights for technical leaders, covering everything from upskilling teams to observability best practices

Learn More

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs