question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Amplify on launch requests permission for notifications, which is undesirable

See original GitHub issue

Describe the bug When launching an iOS React Native application the user is immediately asked to enable push notifications. This happens, I believe, because Amplify.configure() eventually calls PushNotification.initializeIOS().

To Reproduce Create an iOS React Native application and run Amplify.configure().

Expected behavior Request permission to send notifications later, when needed. e.g., after an onboarding flow, sign-in, etc.

Smartphone (please complete the following information):

  • Device: iPhone 8
  • OS: iOS 12.0

Additional context

It would be nice if this were removed from PushNotification.initializeIOS():

PushNotificationIOS.requestPermissions({
  alert: true,
  badge: true,
  sound: true
});

And instead were a separate method (e.g., PushNotification.requestPermissionsIOS().

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

8reactions
lafioscacommented, Feb 13, 2019

I submitted my own PR #2697 to add this functionality because my team also needs it for our app. I used the config option approach to maintain backward compatibility as requested. Please let me know if it looks ok, @powerful23

The way it works is that you configure PushNotification to not automatically request permissions:

PushNotification.configure({ requestIOSPermissions: false });

Then later when you are ready to request the permission, you can manually call this method:

PushNotification.requestIOSPermissions();

After you allow the permission in the app, the device token will be received by the library.

Hope this helps.

1reaction
dylan-westburycommented, Dec 11, 2018

Any progress with this? 😀

Read more comments on GitHub >

github_iconTop Results From Across the Web

Notifications - AWS Amplify Hosting
Use notifications to alert stakeholders when an Amplify app build succeeds or fails.
Read more >
APNs Push Notifications for iOS Using AWS Lambda in Swift
Kilo Loco covers the end to end process of setting up APNs Push Notifications using AWS Amplify and AWS Lambda all in Swift....
Read more >
Use notifications to get alerts - Computer - Google Chrome Help
Important: If you allowed notifications for a site that Chrome marked as abusive or misleading, Chrome may block those notifications and require the...
Read more >
Send an SMS to Customers Using React and AWS Amplify
When it comes to sending push notifications, email, or SMS, AWS has a service known as Amazon Simple Notification Service or SNS. In...
Read more >
Android 13 Developer Preview: Push Opt-Ins Arrive for ... - Braze
What's changing for push notifications in Android 13 ... 13 will now need to request permission from the user before posting notifications,” ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found