braze-inc / braze-react-native-sdk

Public repo for the Braze React Native SDK
https://www.braze.com
Other
64 stars 83 forks source link

How not to request push permission upon launching the app using Expo? #218

Closed plambir93kek closed 1 year ago

plambir93kek commented 1 year ago

Which Platforms?

Both

Which React Native Version?

0.71.8

Which @braze/react-native-sdk SDK version?

^4.1.0

Repro Rate

100%

Steps To Reproduce

1) Set up Braze for React Native Expo. 2) First time after installation launch the app.

The first time the app is launched, Braze immediately requests push notifications permission. How to avoid this and control permission's request?

Expected Behavior

Notification permission and token should be asked only when i call Braze.requestPushPermission(permissionOptions);

Actual Incorrect Behavior

The first time the app is launched, Braze immediately requests push notifications permission and i can't prevent it.

Verbose Logs

No response

Additional Information

No response

plambir93kek commented 1 year ago

Please note, i am using Expo managed workflow.

plambir93kek commented 1 year ago

That was my mistake. Problem was related to other SDK my app using, not Braze.

ioetbc commented 4 months ago

Hey @plambir93kek i'm having the same problem, are you able to expand your answer? which SDK was causing the actual issue?

jerielng commented 4 months ago

@ioetbc Could you confirm which platform(s) you are observing this behavior on, and which Braze configurations/methods you are using to set up push notification integration?

ioetbc commented 4 months ago

thanks for getting back so quick @jerielng i'm experiencing it on IOS only here is my configuration: [ "@braze/expo-plugin", { iosApiKey: process.env.BRAZE_IOS_API_KEY, androidApiKey: process.env.BRAZE_ANDROID_API_KEY, baseUrl: process.env.BRAZE_BASE_URL, firebaseCloudMessagingSenderId: process.env.FIREBASE_CLOUD_MESSAGING_SENDER_ID, enableBrazeIosPush: true, iosRequestPushPermissionsAutomatically: false, enableFirebaseCloudMessaging: true, }, ],

jerielng commented 4 months ago

@ioetbc Thanks for the details! It looks like you should have it configured correctly. That iosRequestPushPermissionsAutomatically setting should disable this feature. Unfortunately, I'm not able to reproduce this from our end. Our best recommendation is to verify that the authorization request is not coming from a separate SDK or configuration, as plambir93kek experienced.

If you are still facing this issue even after ruling out any other SDKs, could you write into our support team at support@braze.com with as many details as you can provide about your project setup (SDK versions, any relevant integration code), and if possible provide a minimal reproducible sample?