Closed MaganAnkur closed 4 years ago
@MaganAnkur Please respect the issue template, give some code, etc. I'm not a wizard 😅
@zoontek I am using below .configure() on app load
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: true,
});
}
I am not using Permissions.request('notification') any where on app launch still I can see request pop up at launch.
I have also tried removing .configure() code from app load still request pop is coming.
This looks more an issue with react-native-push-notification.
Did you tried setting popInitialNotification: false
(https://github.com/zo0r/react-native-push-notification#usage)?
@MaganAnkur One thing to know: If you didn't linked the Permission-Notifications
pod, its absolutely impossible that it comes from react-native-permissions
because the native code needed to request this permission isn't even present. That's the beauty of segmented permission handlers.
Edit: wait do you use react-native-permissions v1? You said Permissions.request('notification')
. This is not the way to request them in v2.
@zoontek firstly i was under the same impression but i deleted the react push notification code, still I am getting the pop up. Yes, I am using react native permissions v 1.1.1 Below is my pod file:
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector"
pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired"
pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety"
pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/'
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
pod 'React-Core/DevSupport', :path => '../node_modules/react-native/'
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/'
pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon"
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
pod 'GoogleIDFASupport', '~> 3.14.0'
pod 'Leanplum-iOS-SDK', '2.6.2'
pod 'react-native-webview', :path => '../node_modules/react-native-webview'
pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'
pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'
pod 'react-native-video', :path => '../node_modules/react-native-video'
pod 'rn-fetch-blob', :path => '../node_modules/rn-fetch-blob'
pod 'react-native-orientation-locker', :path => '../node_modules/react-native-orientation-locker'
pod 'react-native-appboy-sdk', :path => '../node_modules/react-native-appboy-sdk'
pod 'react-native-mixpanel', :path => '../node_modules/react-native-mixpanel'
pod 'react-native-branch', :path => '../node_modules/react-native-branch'
pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'
pod 'react-native-leanplum', :path => '../node_modules/@brandingbrand/react-native-leanplum'
pod 'RNSVG', :path => '../node_modules/react-native-svg'
rn_path = '../node_modules/react-native'
rn_maps_path = '../node_modules/react-native-maps'
# React Native third party dependencies podspecs
pod 'ReactNativePermissions', :path => '../node_modules/react-native-permissions'
pod 'RNFastImage', :path => '../node_modules/react-native-fast-image'
# react-native-maps dependencies
pod 'react-native-maps', path: rn_maps_path
pod 'react-native-google-maps', path: rn_maps_path # Uncomment this line if you want to support GoogleMaps on iOS
pod 'GoogleMaps' # Uncomment this line if you want to support GoogleMaps on iOS
pod 'Google-Maps-iOS-Utils' # Uncomment this line if you want to support GoogleMaps on iOS
pod 'RNGoogleSignin', :path => '../node_modules/@react-native-community/google-signin'
pod 'GoogleSignIn'
pod 'react-native-config', :path => '../node_modules/react-native-config'
pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk'
pod 'RNFBApp', :path => '../node_modules/@react-native-firebase/app'
pod 'RNFBAuth', :path => '../node_modules/@react-native-firebase/auth'
pod 'RNLocalize', :path => '../node_modules/react-native-localize'
pod 'RNCPushNotificationIOS', :path => '../node_modules/@react-native-community/push-notification-ios'
pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'
pod 'RNBraintreeDropIn', :path => '../src/common/braintree/ios'
pod 'BraintreeDropIn', '~> 7.5.0'
pod 'Braintree/Apple-Pay'
pod 'CardIO'
pod 'RNImageCropPicker', :path => '../node_modules/react-native-image-crop-picker'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'react-native-google-maps'
target.build_configurations.each do |config|
config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
end
end
if target.name == "React"
target.remove_from_project
end
if target.name == 'yoga'
target.remove_from_project
target.build_configurations.each do |config|
config.build_settings['GCC_TREAT_WARNINGS_AS_ERRORS'] = 'NO'
config.build_settings['GCC_WARN_64_TO_32_BIT_CONVERSION'] = 'NO'
end
end
end
end
Below is the code where I am checking for permissions:
const checkIOSPushPermissions = async () => {
let permission = await Permissions.check('notification');
if (permission === 'undetermined') {
permission = await Permissions.request('notification');
return permission === 'authorized';
} else if (permission === 'denied') {
return new Promise(resolve => {
Alert.alert(
translate('general.push.title'),
translate('general.push.message'),
[
{
text: translate('general.push.ok'),
onPress: async () => {
await Permissions.openSettings();
resolve(true);
},
},
{
text: translate('general.push.cancel'),
onPress: () => resolve(false),
style: 'cancel',
},
],
);
});
}
return true;
};
react-native-permissions v1 is not supported anymore. Switch to v2 and don't link the notifications handler, because you don't need it.
See the README for support: https://github.com/react-native-community/react-native-permissions#support
@zoontek May I know why npm install --save react-native-permissions is not installing v2 instead its installing v1.2.1
@MaganAnkur Probably some misconfiguration with npm on your computer. I just gave it a try and everything worked correctly, the latest version was installed.
@zoontek I have updated it and after building the code I am getting below error:
Below is my PODFile: ` platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
target 'App' do
project 'SPC', 'QA-Debug' => :debug, 'Staging-Debug' => :debug, 'Production-Debug' => :debug, 'QA-Release' => :release, 'Staging-Release' => :release, 'Production-Release' => :release
pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector" pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec" pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired" pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety" pod 'React', :path => '../node_modules/react-native/' pod 'React-Core', :path => '../node_modules/react-native/' pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules' pod 'React-Core/DevSupport', :path => '../node_modules/react-native/' pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS' pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation' pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob' pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image' pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS' pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network' pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings' pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text' pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration' pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/' pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact' pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi' pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor' pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector' pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon" pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon" pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga' pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec' pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec' pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
pod 'GoogleIDFASupport', '~> 3.14.0' pod 'Leanplum-iOS-SDK', '2.6.2' pod 'react-native-webview', :path => '../node_modules/react-native-webview' pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo' pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info' pod 'react-native-video', :path => '../node_modules/react-native-video' pod 'rn-fetch-blob', :path => '../node_modules/rn-fetch-blob' pod 'react-native-orientation-locker', :path => '../node_modules/react-native-orientation-locker' pod 'react-native-appboy-sdk', :path => '../node_modules/react-native-appboy-sdk' pod 'react-native-mixpanel', :path => '../node_modules/react-native-mixpanel' pod 'react-native-branch', :path => '../node_modules/react-native-branch' pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage' pod 'react-native-leanplum', :path => '../node_modules/@brandingbrand/react-native-leanplum' pod 'RNSVG', :path => '../node_modules/react-native-svg'
rn_path = '../node_modules/react-native' rn_maps_path = '../node_modules/react-native-maps'
pod 'RNPermissions', :path => '../node_modules/react-native-permissions' pod 'RNFastImage', :path => '../node_modules/react-native-fast-image'
pod 'react-native-maps', path: rn_maps_path pod 'react-native-google-maps', path: rn_maps_path # Uncomment this line if you want to support GoogleMaps on iOS pod 'GoogleMaps' # Uncomment this line if you want to support GoogleMaps on iOS pod 'Google-Maps-iOS-Utils' # Uncomment this line if you want to support GoogleMaps on iOS
pod 'RNGoogleSignin', :path => '../node_modules/@react-native-community/google-signin' pod 'GoogleSignIn'
pod 'react-native-config', :path => '../node_modules/react-native-config'
pod 'react-native-fbsdk', :path => '../node_modules/react-native-fbsdk'
pod 'RNFBApp', :path => '../node_modules/@react-native-firebase/app' pod 'RNFBAuth', :path => '../node_modules/@react-native-firebase/auth'
pod 'RNLocalize', :path => '../node_modules/react-native-localize'
pod 'RNCPushNotificationIOS', :path => '../node_modules/@react-native-community/push-notification-ios'
pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler'
pod 'RNBraintreeDropIn', :path => '../src/common/braintree/ios' pod 'BraintreeDropIn', '~> 7.5.0' pod 'Braintree/Apple-Pay'
pod 'CardIO'
pod 'RNImageCropPicker', :path => '../node_modules/react-native-image-crop-picker'
end
post_install do |installer| installer.pods_project.targets.each do |target| if target.name == 'react-native-google-maps' target.build_configurations.each do |config| config.build_settings['CLANG_ENABLE_MODULES'] = 'No' end end if target.name == "React" target.remove_from_project end if target.name == 'yoga' target.remove_from_project target.build_configurations.each do |config| config.build_settings['GCC_TREAT_WARNINGS_AS_ERRORS'] = 'NO' config.build_settings['GCC_WARN_64_TO_32_BIT_CONVERSION'] = 'NO' end end end end `
@MaganAnkur Read the documentation.
@zoontek I have successfully updated the version but I am still getting the request pop up at app launch, could you please give some insights?
same issue here.
after installing react-native-permission, app started to show notification permission popup when launching. it does not work like this before installing react-native-permission.
even if I don't request anything with react-native-permission, it happens.
I'm using 3.0.1
Any suggestions guys? I am facing same issue too
As this is a closed issue, I suggest a minimal repro and clear explanation of the test environment (that is: is it android 13 only? or other versions? )
https://stackoverflow.com/help/how-to-ask https://stackoverflow.com/help/minimal-reproducible-example
This issue was closed more than 2 years ago and if you maintained this repo or any repo, would you take time from your workday, head over to mostly-volunteer repo, spend time on an issue that was closed 2 years ago and has no clear steps to reproduce + reproduction? If you reflect honestly on that question, I would be the answer is no :-)
Just for the future readers. I managed to fix it by removing @react-native-community/push-notification-ios
(since we were not using it) and deleted corresponding modifications in AppDelegate.h
and AppDelegate.m
files, made during initial instalation of the library (as per documentation)
In my case, a third-party library (Intercom) was asking for permissions on launch - it had nothing to do with this module.
hi, any update please ? with iOS. on app lauch, it always asking permission for Notifications. And if i press deny on the first time. the function requestNotifications(...) will always give status 'blocked'
// package.json "react-native": "0.68.7" "react-native-permissions": "^4.1.2" "@react-native-firebase/messaging: "19.1.2" // not sure if firebase relative with // Podfile ... require_relative '../node_modules/react-native-permissions/scripts/setup' node_require('react-native-permissions/scripts/setup.rb') setup_permissions(['Notifications'])
hi, any update please ? with iOS. on app lauch, it always asking permission for Notifications. And if i press deny on the first time. the function requestNotifications(...) will always give status 'blocked'
// package.json "react-native": "0.68.7" "react-native-permissions": "^4.1.2" "@react-native-firebase/messaging: "19.1.2" // not sure if firebase relative with // Podfile ... require_relative '../node_modules/react-native-permissions/scripts/setup' node_require('react-native-permissions/scripts/setup.rb') setup_permissions(['Notifications'])
getting the same issue here
hi, any update please ? with iOS. on app lauch, it always asking permission for Notifications. And if i press deny on the first time. the function requestNotifications(...) will always give status 'blocked' // package.json "react-native": "0.68.7" "react-native-permissions": "^4.1.2" "@react-native-firebase/messaging: "19.1.2" // not sure if firebase relative with // Podfile ... require_relative '../node_modules/react-native-permissions/scripts/setup' node_require('react-native-permissions/scripts/setup.rb') setup_permissions(['Notifications'])
getting the same issue here
Did u try to upgrade lastest version of rnfirebase ? it might help.
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 have not asked for requestPermission on app load.
Please let me know the way how can I stop auto ask permission on app launch.