ios icon indicating copy to clipboard operation
ios copied to clipboard

Notification Permission Pop up is displaying on app launch

Open MaganAnkur opened this issue 5 years ago • 4 comments

For some reason the popup asking permission for the push notifications is showing automatically when the app is opened for the first time even if I am configuring Push Notification later in the app.

Please let me know the way how can I stop auto ask permission on app launch.

Below is my componentDidMount code in entry file:

`componentDidMount() { AppState.addEventListener('change', this.appStateDidChange) Orientation.lockToPortrait() Orientation.addDeviceOrientationListener(this.orientationDidChange) this.unsubscribeAuthStateChangeListener = firebase .auth() .onAuthStateChanged(this.authStateDidChange) this.unsubscribeNetInfoStatListener = NetInfo.addEventListener( this.props.setNetStat )

this.fetchData()
this.initBranch()

if (this.props.isLoggedIn && this.props.isFirebaseAuthenticated) {
  if (this.props.hasValidCards) {
    Orientation.unlockAllOrientations()
  }

  navigate(Routes.Main)
  this.props.getCards()
}

this.updateLocationPermissionState()

//Repositioning this to after create account notification prompt
PushNotification.configure({
  onRegister: token => {
    LeanplumManager.setUserPushToken(token.token)
  },
  senderId: Config.FIREBASE_CLOUD_MESSAGING_SENDER_ID,
  requestPermissions: false,
  popInitialNotification: false
})

}`

MaganAnkur avatar May 06 '20 19:05 MaganAnkur

It's because of UNUserNotificationCenter part in didFinishLaunchingWithOptions (AppDelegate.m)

kasterlod avatar Jun 13 '20 07:06 kasterlod

@kasterlod okay, makes sense, but can it be put somewhere else so we can call requestPermissions() at a specific time from the react layer?

naajaw avatar Jan 20 '21 23:01 naajaw

How do i lately ask for permission ?

dzpt avatar Aug 30 '21 19:08 dzpt

Where can it be put in order to delay the requestPermissions()

It's because of UNUserNotificationCenter part in didFinishLaunchingWithOptions (AppDelegate.m)

lucianobracco-geojam avatar May 03 '23 04:05 lucianobracco-geojam