invertase / react-native-firebase

πŸ”₯ A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.68k stars 2.21k forks source link

[πŸ›] :fire: Firebase not collecting data and Push Notification not being received iOS #7009

Closed carloslibardo closed 1 year ago

carloslibardo commented 1 year ago

Issue

I use firebase for some functionality, mainly the authentication and push notifications part.

We have multiple clients, and for each client we create two apps in firebase (iOS and Android), everything is working fine except for one specific client.

I noticed the problem when I went to send push notifications and it said that the number of reachable users in the campaign was 0, then I looked at the user reports and it also seems not to be receiving metrics.

When performing the test push notification test I can receive the notification, however when creating a campaign no client of mine receives the notification, I don't know what it could be, already spend a few days trying hard.


Project Files

Javascript

Click To Expand

#### `package.json`: ```json "dependencies": { "@apollo/client": "^3.4.8", "@ptomasroos/react-native-multi-slider": "^2.2.2", "@react-native-community/async-storage": "^1.7.1", "@react-native-community/checkbox": "^0.5.5", "@react-native-community/cli-platform-android": "3.0.3", "@react-native-community/google-signin": "^3.0.4", "@react-native-community/masked-view": "^0.1.11", "@react-native-community/netinfo": "^5.6.2", "@react-native-firebase/analytics": "^12.9.3", "@react-native-firebase/app": "^12.9.3", "@react-native-firebase/auth": "^12.9.3", "@react-native-firebase/firestore": "^12.9.3", "@react-native-firebase/messaging": "^12.9.3", "@react-navigation/compat": "^5.x", "@react-navigation/drawer": "^5.x", "@react-navigation/material-top-tabs": "^5.x", "@react-navigation/native": "^5.x", "@react-navigation/native-stack": "^5.x", "@react-navigation/stack": "^5.x", "@sentry/react-native": "^2.6.2", "card-validator": "^8.0.0", "cep-promise": "^3.0.9", "graphql": "^14.5.8", "i18next": "^21.8.14", "jetifier": "^1.6.5", "lottie-ios": "3.1.8", "lottie-react-native": "^3.5.0", "mixpanel-react-native": "^1.3.10", "moment": "^2.24.0", "moment-range": "^4.0.2", "react": "16.9.0", "react-i18next": "^11.18.1", "react-mobile-picker-scroll": "^0.2.14", "react-native": "0.61.5", "react-native-app-auth": "^6.4.3", "react-native-camera": "^3.19.1", "react-native-circular-progress": "^1.3.6", "react-native-code-push": "6.0.0", "react-native-config": "^1.4.4", "react-native-currency-input": "^1.1.0", "react-native-device-info": "^5.4.1", "react-native-fbsdk": "^1.1.2", "react-native-geocoding": "^0.5.0", "react-native-geolocation-service": "^3.1.0", "react-native-gesture-handler": "^1.5.3", "react-native-google-places-autocomplete": "^2.4.1", "react-native-linear-gradient": "^2.5.6", "react-native-logs": "^3.0.4", "react-native-map-link": "^2.7.19", "react-native-maps": "0.26.1", "react-native-maps-super-cluster": "^1.6.0", "react-native-modals": "^0.22.3", "react-native-pager-view": "^5.4.15", "react-native-paper": "^4.9.1", "react-native-permissions": "^3.1.0", "react-native-reanimated": "1.4.0", "react-native-root-siblings": "^4.1.0", "react-native-safe-area-context": "^3.x", "react-native-screens": "^2.0.0-alpha.22", "react-native-simple-radio-button": "^2.7.4", "react-native-splash-screen": "^3.2.0", "react-native-status-bar-height": "^2.5.0", "react-native-svg": "^11.0.1", "react-native-tab-view": "^2.x", "react-native-vector-icons": "^8.1.0", "react-native-webview": "^11.10.2", "react-native-wizard": "^2.0.0", "rxjs": "^6.5.4", "styled-components": "^5.3.5" }, ``` #### `firebase.json` for react-native-firebase v6: ```json # N/A ```

iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby platform :ios, '11.0' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' abstract_target 'defaults' do # Pods for thor 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 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler' pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient' pod 'GoogleIDFASupport', '~> 3.14.0' permissions_path = '../node_modules/react-native-permissions/ios' pod 'Permission-AppTrackingTransparency', :path => "#{permissions_path}/AppTrackingTransparency" pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways" pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse" pod 'react-native-geolocation', path: '../node_modules/@react-native-community/geolocation' rn_maps_path = '../node_modules/react-native-maps' pod 'react-native-google-maps', :path => rn_maps_path pod 'GoogleMaps' pod 'Google-Maps-iOS-Utils' target 'thorTests' do inherit! :search_paths # Pods for testing end use_native_modules! end target 'thor-tvOS' do # Pods for thor-tvOS target 'thor-tvOSTests' do inherit! :search_paths # Pods for testing end ENVFILES = { 'Debug' => '$(PODS_ROOT)/../../.env.dev', 'Dev' => '$(PODS_ROOT)/../../.env.dev', 'Staging' => '$(PODS_ROOT)/../../.env.staging', 'Release' => '$(PODS_ROOT)/../../.env.prod', } post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| if target.name == 'react-native-config' config.build_settings['ENVFILE'] = ENVFILES[config.name] end end end installer.pods_project.build_configurations.each do |config| config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" end ## Fix for XCode 12.5 beta find_and_replace("../node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm", "_initializeModules:(NSArray> *)modules", "_initializeModules:(NSArray *)modules") find_and_replace("../node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm", "RCTBridgeModuleNameForClass(module))", "RCTBridgeModuleNameForClass(Class(module)))") end end def find_and_replace(dir, findstr, replacestr) Dir[dir].each do |name| text = File.read(name) replace = text.gsub(findstr,replacestr) if text != replace puts "Fix: " + name File.open(name, "w") { |file| file.puts replace } STDOUT.flush end end Dir[dir + '*/'].each(&method(:find_and_replace)) end ``` #### `AppDelegate.m`: ```objc /** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #import "AppDelegate.h" #import #import #import #import #import #import #import #import "RNSplashScreen.h" #import @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions]; [GMSServices provideAPIKey:@"XXXXXXXXXXXXXXXXX"]; if ([FIRApp defaultApp] == nil) { [FIRApp configure]; } // Push Notifications if ([UNUserNotificationCenter class] != nil) { // iOS 10 or later // For iOS 10 display notification (sent via APNS) [UNUserNotificationCenter currentNotificationCenter].delegate = self; UNAuthorizationOptions authOptions = UNAuthorizationOptionAlert | UNAuthorizationOptionSound | UNAuthorizationOptionBadge; [[UNUserNotificationCenter currentNotificationCenter] requestAuthorizationWithOptions:authOptions completionHandler:^(BOOL granted, NSError * _Nullable error) { // ... }]; } else { // iOS 10 notifications aren't available; fall back to iOS 8-9 notifications. UIUserNotificationType allNotificationTypes = (UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge); UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:allNotificationTypes categories:nil]; [application registerUserNotificationSettings:settings]; } [application registerForRemoteNotifications]; [FIRMessaging messaging].delegate = self; // TODO: verificar // [START set_messaging_delegate] //Β [FIRMessaging messaging].delegate = self; // [END set_messaging_delegate] RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge moduleName:@"thor" initialProperties:nil]; rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; UIViewController *rootViewController = [UIViewController new]; rootViewController.view = rootView; self.window.rootViewController = rootViewController; [self.window makeKeyAndVisible]; [RNSplashScreen show]; return YES; } - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { return YES; } - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary *)options { if ([self.authorizationFlowManagerDelegate resumeExternalUserAgentFlowWithURL:url]) { return YES; } // Add any custom logic here. if ([[FBSDKApplicationDelegate sharedInstance] application:application openURL:url options:options]) { return YES; } return [RCTLinkingManager application:application openURL:url options:options]; } - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge { #if DEBUG return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; #else return [CodePush bundleURL]; #endif } @end ```


Android

Click To Expand

#### Have you converted to AndroidX? - [x] my application is an AndroidX application? - [x] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [x] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`: ```groovy // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { ext { buildToolsVersion = "28.0.3" minSdkVersion = 21 compileSdkVersion = 31 targetSdkVersion = 31 supportLibVersion = "28.0.3" googlePlayServicesVersion = "17.0.0" androidMapsUtilsVersion = "0.5+" } repositories { mavenCentral() google() mavenCentral() maven { url 'https://maven.fabric.io/public' } } dependencies { classpath("com.android.tools.build:gradle:3.5.4") classpath 'com.google.gms:google-services:4.3.3' classpath 'io.fabric.tools:gradle:1.28.1' } } // remove this line when update react version to 0.65+ -> https://github.com/facebook/react-native/issues/35210 def REACT_NATIVE_VERSION = new File(['node', '--print',"JSON.parse(require('fs').readFileSync(require.resolve('react-native/package.json'), 'utf-8')).version"].execute(null, rootDir).text.trim()) allprojects { repositories { mavenLocal() maven { // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm url("$rootDir/../node_modules/react-native/android") } maven { // Android JSC is installed from npm url("$rootDir/../node_modules/jsc-android/dist") } google() mavenCentral() maven { url 'https://www.jitpack.io' } } configurations.all { // remove this block when update react version to 0.65+ -> https://github.com/facebook/react-native/issues/35210 resolutionStrategy { force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION } } } ``` #### `android/app/build.gradle`: ```groovy apply plugin: "com.android.application" apply plugin: "io.fabric" import com.android.build.OutputFile /** * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets * and bundleReleaseJsAndAssets). * These basically call `react-native bundle` with the correct arguments during the Android build * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the * bundle directly from the development server. Below you can see all the possible configurations * and their defaults. If you decide to add a configuration block, make sure to add it before the * `apply from: "../../node_modules/react-native/react.gradle"` line. * * project.ext.react = [ * // the name of the generated asset file containing your JS bundle * bundleAssetName: "index.android.bundle", * * // the entry file for bundle generation * entryFile: "index.android.js", * * // https://facebook.github.io/react-native/docs/performance#enable-the-ram-format * bundleCommand: "ram-bundle", * * // whether to bundle JS and assets in debug mode * bundleInDebug: false, * * // whether to bundle JS and assets in release mode * bundleInRelease: true, * * // whether to bundle JS and assets in another build variant (if configured). * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants * // The configuration property can be in the following formats * // 'bundleIn${productFlavor}${buildType}' * // 'bundleIn${buildType}' * // bundleInFreeDebug: true, * // bundleInPaidRelease: true, * // bundleInBeta: true, * * // whether to disable dev mode in custom build variants (by default only disabled in release) * // for example: to disable dev mode in the staging build type (if configured) * devDisabledInStaging: true, * // The configuration property can be in the following formats * // 'devDisabledIn${productFlavor}${buildType}' * // 'devDisabledIn${buildType}' * * // the root of your project, i.e. where "package.json" lives * root: "../../", * * // where to put the JS bundle asset in debug mode * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", * * // where to put the JS bundle asset in release mode * jsBundleDirRelease: "$buildDir/intermediates/assets/release", * * // where to put drawable resources / React Native assets, e.g. the ones you use via * // require('./image.png')), in debug mode * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", * * // where to put drawable resources / React Native assets, e.g. the ones you use via * // require('./image.png')), in release mode * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", * * // by default the gradle tasks are skipped if none of the JS files or assets change; this means * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to * // date; if you have any other folders that you want to ignore for performance reasons (gradle * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ * // for example, you might want to remove it from here. * inputExcludes: ["android/**", "ios/**"], * * // override which node gets called and with what additional arguments * nodeExecutableAndArgs: ["node"], * * // supply additional arguments to the packager * extraPackagerArgs: [] * ] */ project.ext.react = [ entryFile: "index.js", enableHermes: false, // clean and rebuild if changing devDisabledInStaging: true, devDisabledInDev: true, bundleInRelease: true, bundleInStaging: true, bundleInDev: true ] apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle" apply from: "../../node_modules/react-native/react.gradle" apply from: "../../node_modules/react-native-code-push/android/codepush.gradle" /** * Set this to true to create two separate APKs instead of one: * - An APK that only works on ARM devices * - An APK that only works on x86 devices * The advantage is the size of the APK is reduced by about 4MB. * Upload all the APKs to the Play Store and people will download * the correct one based on the CPU architecture of their device. */ def enableSeparateBuildPerCPUArchitecture = false /** * Run Proguard to shrink the Java bytecode in release builds. */ def enableProguardInReleaseBuilds = false /** * The preferred build flavor of JavaScriptCore. * * For example, to use the international variant, you can use: * `def jscFlavor = 'org.webkit:android-jsc-intl:+'` * * The international variant includes ICU i18n library and necessary data * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that * give correct results when using with locales other than en-US. Note that * this variant is about 6MiB larger per architecture than default. */ def jscFlavor = 'org.webkit:android-jsc:+' /** * Whether to enable the Hermes VM. * * This should be set on project.ext.react and mirrored here. If it is not set * on project.ext.react, JavaScript will not be compiled to Hermes Bytecode * and the benefits of using Hermes will therefore be sharply reduced. */ def enableHermes = project.ext.react.get("enableHermes", false); android { dexOptions { javaMaxHeapSize "3g" } compileSdkVersion rootProject.ext.compileSdkVersion compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } defaultConfig { // https://github.com/microsoft/react-native-code-push/issues/1961 resValue 'string', "CODE_PUSH_APK_BUILD_TIME", String.format("\"%d\"", System.currentTimeMillis()) resValue "string", "build_config_package", "xxx" manifestPlaceholders = [ appAuthRedirectScheme: 'xxx' ] minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion /** * This was necesary because in the cemig's splash-screen, * is using only ConstraintsLayout (this is the better and recommended to use), * the previous, were made using RelativeLayout */ vectorDrawables.useSupportLibrary = true multiDexEnabled true missingDimensionStrategy 'react-native-camera', 'mlkit' versionCode 1 versionName "1.0.0" } splits { abi { reset() enable enableSeparateBuildPerCPUArchitecture universalApk false // If true, also generate a universal APK include "armeabi-v7a", "x86", "arm64-v8a", "x86_64" } } signingConfigs { debug { storeFile file('debug.keystore') storePassword 'android' keyAlias 'androiddebugkey' keyPassword 'android' } } buildTypes { debug { signingConfig signingConfigs.debug } release { // Caution! In production, you need to generate your own keystore file. // see https://facebook.github.io/react-native/docs/signed-apk-android. signingConfig signingConfigs.release minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } dev { signingConfig signingConfigs.release minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" matchingFallbacks = ['release'] } staging { signingConfig signingConfigs.release minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" matchingFallbacks = ['release'] } flavorDimensions "xxx" productFlavors { xxx { dimension "xxx" applicationId "xxx" resValue "string", "app_name", "xxx" } } } // applicationVariants are e.g. debug, release applicationVariants.all { variant -> variant.outputs.each { output -> // For each separate APK per architecture, set a unique version code as described here: // https://developer.android.com/studio/build/configure-apk-splits.html def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4] def abi = output.getFilter(OutputFile.ABI) if (abi != null) { // null for the universal-debug, universal-release variants output.versionCodeOverride = versionCodes.get(abi) * 1048576 + defaultConfig.versionCode } } } } dependencies { implementation 'com.facebook.android:facebook-android-sdk:[5,6)' def multidex_version = "2.0.1" implementation "androidx.multidex:multidex:$multidex_version" implementation fileTree(dir: "libs", include: ["*.jar"]) implementation "com.facebook.react:react-native:+" // From node_modules implementation 'androidx.appcompat:appcompat:1.1.0-rc01' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0-alpha02' implementation 'com.google.android.gms:play-services-auth:18.0.0' implementation('com.crashlytics.sdk.android:crashlytics:2.9.9@aar') { transitive = true } implementation 'androidx.constraintlayout:constraintlayout:1.1.3' if (enableHermes) { def hermesPath = "../../node_modules/hermes-engine/android/"; debugImplementation files(hermesPath + "hermes-debug.aar") releaseImplementation files(hermesPath + "hermes-release.aar") } else { implementation jscFlavor } } // Run this once to be able to run the application with BUCK // puts all compile dependencies into folder libs for BUCK to use task copyDownloadableDepsToLibs(type: Copy) { from configurations.compile into 'libs' } apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project) apply plugin: 'com.google.gms.google-services' ``` #### `android/settings.gradle`: ```groovy rootProject.name = 'thor' include ':react-native-splash-screen' project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android') apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings) include ':app' include ':app', ':react-native-code-push' project(':react-native-code-push').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-code-push/android/app') ``` #### `MainApplication.java`: ```java package xxx; import androidx.multidex.MultiDexApplication; import android.content.Context; import com.facebook.react.PackageList; import com.facebook.react.ReactApplication; import smartLock.SmartLockPackage; import flagSecure.FlagSecurePackage; import androidLayout.AndroidLayoutPackage; import com.facebook.react.ReactNativeHost; import com.facebook.react.ReactPackage; import com.facebook.soloader.SoLoader; import java.lang.reflect.InvocationTargetException; import java.util.List; import com.facebook.FacebookSdk; import com.facebook.appevents.AppEventsLogger; import com.microsoft.codepush.react.CodePush; public class MainApplication extends MultiDexApplication implements ReactApplication { private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected String getJSBundleFile() { return CodePush.getJSBundleFile(); } @Override protected List getPackages() { @SuppressWarnings("UnnecessaryLocalVariable") List packages = new PackageList(this).getPackages(); packages.add(new SmartLockPackage()); packages.add(new AndroidLayoutPackage()); packages.add(new FlagSecurePackage()); return packages; } @Override protected String getJSMainModuleName() { return "index"; } }; @Override public ReactNativeHost getReactNativeHost() { return mReactNativeHost; } @Override public void onCreate() { super.onCreate(); FacebookSdk.setApplicationId(getString(R.string.facebook_app_id)); FacebookSdk.sdkInitialize(this); AppEventsLogger.activateApp(this); SoLoader.init(this, /* native exopackage */ false); initializeFlipper(this); // Remove this line if you don't want Flipper enabled } /** * Loads Flipper in React Native templates. * * @param context */ private static void initializeFlipper(Context context) { if (BuildConfig.DEBUG) { try { /* * We use reflection here to pick up the class that initializes Flipper, since * Flipper library is not available in release mode */ Class aClass = Class.forName("com.facebook.flipper.ReactNativeFlipper"); aClass.getMethod("initializeFlipper", Context.class).invoke(null, context); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } catch (InvocationTargetException e) { e.printStackTrace(); } } } } ``` #### `AndroidManifest.xml`: ```xml ```


Environment

Click To Expand

**`react-native info` output:** ``` System: OS: macOS 13.2 CPU: (4) x64 Intel(R) Core(TM) i3-8100B CPU @ 3.60GHz Memory: 28.33 MB / 20.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.15.0 - ~/.nvm/versions/node/v16.15.0/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 8.5.5 - ~/.nvm/versions/node/v16.15.0/bin/npm Watchman: 2023.02.13.00 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 IDEs: Android Studio: 2021.2 AI-212.5712.43.2112.8815526 Xcode: 14.2/14C18 - /usr/bin/xcodebuild npmPackages: react: 16.9.0 => 16.9.0 react-native: 0.61.5 => 0.61.5 ``` - **Platform that you're experiencing the issue on**: - [x] iOS - [ ] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `12.9.3` - **`Firebase` module(s) you're using that has the issue:** - `react-native-firebase/messaging` - **Are you using `TypeScript`?** - `Y` & `3.7.3`


mikehardy commented 1 year ago

With apologies these versions of react-native-firebase are unsupportable, I'm not sure they correctly handle modern versions of mobile operating systems at this point

Separately, without a reproduction case based on logs from devices that receive the FCMs and a minimal / complete reproduction app, I'm not sure we can help

carloslibardo commented 1 year ago

@mikehardy

First of all, thank you very much for your feedback, I admit that I am hopeless and lost in which way to go hahaha.

So, I know they work, I have around 20 apps (40 iOS and Android combined) and they all work correctly, only this one in particular doesn't, which leads me to believe that there is a specific configuration problem with this app (some file , I don't know...)

It's even difficult to give a non-reproducible version, but I can try if necessary, if you could give me a north of things to check, which would only make this application unable to receive push notifications, I already checked things like the bundleId is correct , for example, but I lack input to understand what else could be wrong to check.

mikehardy commented 1 year ago

Job number 1 for you is to get it to reproduce locally, while watching the device logs very very very closely

The logs will typically indicate why the FCM is not being delivered.

Ideally the FCM you are sending to the iOS device is sent programmatically and you check whether the send had an error not as well. Perhaps there is something going on in this app with regard to device tokens.

This is all general advice though, unfortunately they are just ideas because project-specific problems are not really actionable here. In general if something is not going to result in a code change in this project, it's not a valid issue and we close it

carloslibardo commented 1 year ago

Thanks for the feedback, on next week I'll try to get back to this topic and get some logs that can help me arrive at the solution, I'll share it here if I manage to make progress in some way.

I wanted to share some information that might be useful to understand what's going on, I don't know what causes this to happen but I believe it's totally related to the fact that my app doesn't receive push notifications.

Clipboard

As shown in the image, for my application, no user would receive the campaign push notification (all other apps show user numbers), this leads me to believe that somehow the app is not "registering users", I don't know what makes this happen, any insight, or any documentation on that part?

Thanks in advance.

(In the text it says "0% of potential users are eligible for this campaign:0")

mikehardy commented 1 year ago

If no installed instances of the app are self-registering as members of an intended segment, that sounds like an analytics / config setup issue and is probably your root cause.

More info, maybe useful https://firebase.blog/posts/2019/01/a-crash-course-in-using-new-audiences https://search.brave.com/search?q=no+users+in+firebase+audience https://stackoverflow.com/search?q=%5Bfirebase-analytics%5D+audience+members

github-actions[bot] commented 1 year ago

Hello πŸ‘‹, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.

carloslibardo commented 1 year ago

Hello, I've been trying to acquire more information, but not even a log arrives when I trigger the push notifications, I really don't know how to proceed or how to get more information

github-actions[bot] commented 1 year ago

Hello πŸ‘‹, to help manage issues we automatically close stale issues.

This issue has been automatically marked as stale because it has not had activity for quite some time.Has this issue been fixed, or does it still require attention?

This issue will be closed in 15 days if no further activity occurs.

Thank you for your contributions.