react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

setBackgroundMessageHandler not working for API level 31

Open PrasadFeker opened this issue 3 years ago • 18 comments

Issue

i am getting push notifications for target version 30, But i am not able to get the notifications for target version 31 when app in background


Project Files

Javascript

Click To Expand

package.json:

{
  "name": "User",
  "version": "1.0.38",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint .",
    "postinstall": "npx patch-package"
  },
  "dependencies": {
    "@react-native-community/async-storage": "^1.12.0",
    "@react-native-community/geolocation": "^2.0.2",
    "@react-native-community/google-signin": "^5.0.0",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-native-community/netinfo": "^6.0.2",
    "@react-native-firebase/app": "^10.1.1",
    "@react-native-firebase/crashlytics": "^10.1.1",
    "@react-native-firebase/dynamic-links": "^10.1.1",
    "@react-native-firebase/messaging": "^10.1.1",
    "@react-navigation/native": "^5.7.2",
    "appcenter": "4.4.4",
    "appcenter-analytics": "4.4.4",
    "appcenter-crashes": "4.4.4",
    "aws-sdk": "^2.778.0",
    "i18n-js": "^3.7.1",
    "lodash": "^4.17.20",
    "lottie-react-native": "^4.1.3",
    "moment": "^2.27.0",
    "prop-types": "^15.7.2",
    "qrcode": "^1.5.0",
    "react": "17.0.1",
    "react-native": "0.64.2",
    "react-native-apay": "^1.3.1",
    "react-native-appsflyer": "^6.4.40",
    "react-native-calendars": "^1.403.0",
    "react-native-check-version": "^1.0.16",
    "react-native-code-push": "^7.0.4",
    "react-native-document-picker": "^7.1.1",
    "react-native-dropdownalert": "^4.3.0",
    "react-native-exit-app": "^1.1.0",
    "react-native-fast-image": "^8.3.2",
    "react-native-gesture-handler": "^1.7.0",
    "react-native-get-random-values": "^1.5.0",
    "react-native-image-crop-picker": "^0.33.2",
    "react-native-indicators": "^0.17.0",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-localize": "^1.4.1",
    "react-native-maps": "^0.27.1",
    "react-native-maps-directions": "^1.8.0",
    "react-native-material-menu": "^1.1.3",
    "react-native-modal": "^11.5.6",
    "react-native-modal-popover": "^2.1.0",
    "react-native-otp-verify": "^1.0.4",
    "react-native-reanimated": "^1.10.1",
    "react-native-restart": "0.0.17",
    "react-native-safe-area-context": "^3.1.1",
    "react-native-screens": "^2.9.0",
    "react-native-select-contact": "^1.6.3",
    "react-native-swipe-gestures": "^1.0.5",
    "react-native-tab-view": "^2.15.1",
    "react-native-vector-icons": "^7.1.0",
    "react-native-view-pdf": "^0.12.1",
    "react-native-webview": "^10.9.0",
    "react-native-wheel-scrollview-picker": "^2.0.1",
    "react-navigation": "^4.4.0",
    "react-navigation-drawer": "^2.2.2",
    "react-navigation-stack": "^2.8.3",
    "react-redux": "^7.2.1",
    "redux": "^4.0.5",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.3.0",
    "rn-fetch-blob": "^0.12.0",
    "socket.io-client": "^2.3.0",
    "uuid": "^8.3.1"
  },
  "devDependencies": {
    "@babel/core": "7.10.5",
    "@babel/runtime": "7.10.5",
    "@react-native-community/eslint-config": "1.1.0",
    "babel-jest": "25.5.1",
    "eslint": "6.8.0",
    "jest": "25.5.4",
    "metro-react-native-babel-preset": "0.59.0",
    "react-test-renderer": "16.13.1"
  },
  "jest": {
    "preset": "react-native"
  }
}

firebase.json for react-native-firebase v6:

# N/A

Android

Click To Expand

Have you converted to AndroidX?

  • [ ] my application is an AndroidX application?
  • [ ] I am using android/gradle.settings jetifier=true for Android compatibility?
  • [ ] I am using the NPM package jetifier for react-native compatibility?

android/build.gradle:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "29.0.2"
        minSdkVersion = 21
        compileSdkVersion = 30
        targetSdkVersion = 31
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath('com.android.tools.build:gradle:4.0.1')
        classpath 'com.google.gms:google-services:4.3.4'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.2.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

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()
        jcenter()
        maven { url 'https://maven.google.com' }
        maven { url 'https://www.jitpack.io' }



configurations.all {
    resolutionStrategy {
        // Remove this override in 0.65+, as a proper fix is included in react-native itself.
        force "com.facebook.react:react-native:" + REACT_NATIVE_VERSION
    }
    }


    }
}

android/app/build.gradle:

apply plugin: "com.android.application"

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. If none specified and
 *   // "index.android.js" exists, it will be used. Otherwise "index.js" is
 *   // default. Can be overridden with ENTRY_FILE environment variable.
 *   entryFile: "index.android.js",
 *
 *   // https://reactnative.dev/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 = [
    enableHermes: false,  // clean and rebuild if changing
]

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 {
    compileSdkVersion rootProject.ext.compileSdkVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId "com.shahen"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 23
        versionName "3.0"
        multiDexEnabled true
        vectorDrawables.useSupportLibrary = true
    }
    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'
        }
        release {
            if (project.hasProperty('MYAPP_RELEASE_STORE_FILE')) {
                storeFile file(MYAPP_RELEASE_STORE_FILE)
                storePassword MYAPP_RELEASE_STORE_PASSWORD
                keyAlias MYAPP_RELEASE_KEY_ALIAS
                keyPassword MYAPP_RELEASE_KEY_PASSWORD
            }
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            // Caution! In production, you need to generate your own keystore file.
            // see https://reactnative.dev/docs/signed-apk-android.
            signingConfig signingConfigs.release
            minifyEnabled enableProguardInReleaseBuilds
            proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
        }
    }

    // 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 fileTree(dir: "libs", include: ["*.jar"])
    //noinspection GradleDynamicVersion
    implementation "com.facebook.react:react-native:+"  // From node_modules

    implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"

    implementation project(':react-native-maps') // to implement Maps (Required) and compile is replaced by implementation as it is deprecated

    implementation(project(':react-native-maps')){
        exclude group: 'com.google.android.gms', module: 'play-services-base'
        exclude group: 'com.google.android.gms', module: 'play-services-maps'
    }

    implementation 'com.google.android.gms:play-services-base:10.0.1'
    implementation 'com.google.android.gms:play-services-maps:10.0.1'

     // implementation 'androidx.work:work-runtime:2.7.1'



    debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
      exclude group:'com.facebook.fbjni'
    }

    debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
        exclude group:'com.squareup.okhttp3', module:'okhttp'
    }

    debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
        exclude group:'com.facebook.flipper'
    }

    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'
apply plugin: 'com.google.firebase.crashlytics'

android/settings.gradle:

rootProject.name = 'Shahen'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)

include ':react-native-maps'
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android') // documentation has a worng path. so, check the path before changing

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:

package com.shahen;

import com.facebook.react.modules.i18nmanager.I18nUtil;
import android.app.Application;
import android.content.Context;
import com.facebook.react.PackageList;
import com.facebook.react.ReactApplication;
//import com.faizal.OtpVerify.RNOtpVerifyPackage;
import com.facebook.react.ReactInstanceManager;
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.microsoft.codepush.react.CodePush;

public class MainApplication extends Application 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<ReactPackage> getPackages() {
          @SuppressWarnings("UnnecessaryLocalVariable")
          List<ReactPackage> packages = new PackageList(this).getPackages();
          // Packages that cannot be autolinked yet can be added manually here, for example:
          // packages.add(new MyReactNativePackage());
          return packages;
        }

        @Override
        protected String getJSMainModuleName() {
          return "index";
        }
      };

  @Override
  public ReactNativeHost getReactNativeHost() {
    return mReactNativeHost;
  }

  @Override
  public void onCreate() {
    super.onCreate();
    SoLoader.init(this, /* native exopackage */ false);
    initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
    I18nUtil.getInstance().allowRTL(this, false);
  }

  /**
   * Loads Flipper in React Native templates. Call this in the onCreate method with something like
   * initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
   *
   * @param context
   * @param reactInstanceManager
   */
  private static void initializeFlipper(
      Context context, ReactInstanceManager reactInstanceManager) {
    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.shahen.ReactNativeFlipper");
        aClass
            .getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
            .invoke(null, context, reactInstanceManager);
      } catch (ClassNotFoundException e) {
        e.printStackTrace();
      } catch (NoSuchMethodException e) {
        e.printStackTrace();
      } catch (IllegalAccessException e) {
        e.printStackTrace();
      } catch (InvocationTargetException e) {
        e.printStackTrace();
      }
    }
  }
}

AndroidManifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.shahen">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.CAMERA"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.READ_CONTACTS" />
    <uses-feature android:name="android.hardware.camera" android:required="false" />
    <uses-feature android:name="android.hardware.camera.front" android:required="false" />

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false"
      android:theme="@style/AppTheme"
      android:usesCleartextTraffic="true">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:exported="true"
        android:screenOrientation="portrait"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter android:label="@string/app_name">
          <action android:name="android.intent.action.VIEW" />
          <category android:name="android.intent.category.DEFAULT" />
          <category android:name="android.intent.category.BROWSABLE" />
          <!-- Accepts URIs that begin with "http://www.example.com/path -->
          <data android:scheme="http"
                android:host="shahen-sa.com"
                android:pathPrefix="/app" />
          <!-- note that the scheme is protocol (http / https / custom) and required-->
          <!-- note that the host is domain required-->
          <!-- note that the leading "/" is required for pathPrefix-->
        </intent-filter>
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
     
      <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="AIzaSyCYK25NJBp_hvns5LEzLFpWypH3eKTts2I"/>
    </application>

    <queries>
      <intent>
          <action android:name="android.intent.action.VIEW" />
          <category android:name="android.intent.category.DEFAULT" />
          <data android:mimeType="vnd.android.cursor.dir/contact" />
      </intent>
    </queries>
</manifest>



PrasadFeker avatar Mar 27 '23 10:03 PrasadFeker

Most likely you have not requested android notification permissions, they are required in modern android versions aren't they?

If it is not that, you should check adb logcat while you send an FCM and see what happens. Possibly related: https://dontkillmyapp.com

mikehardy avatar Mar 27 '23 17:03 mikehardy

03-28 00:53:06.275 18025 20205 E AndroidRuntime: FATAL EXCEPTION: Firebase-Messaging-Intent-Handle 03-28 00:53:06.275 18025 20205 E AndroidRuntime: Process: com.shahen, PID: 18025 03-28 00:53:06.275 18025 20205 E AndroidRuntime: java.lang.IllegalArgumentException: com.shahen: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. 03-28 00:53:06.275 18025 20205 E AndroidRuntime: Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles. 03-28 00:53:06.275 18025 20205 E AndroidRuntime: at android.app.PendingIntent.checkFlags(PendingIntent.java:375) 03-28 00:53:06.275 18025 20205 E AndroidRuntime: at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:464) 03-28 00:53:06.275 18025 20205 E AndroidRuntime: at android.app.PendingIntent.getActivity(PendingIntent.java:444) 03-28 00:53:06.275 18025 20205 E AndroidRuntime: at android.app.PendingIntent.getActivity(PendingIntent.java:408) 03-28 00:53:06.275 18025 20205 E AndroidRuntime: at com.google.firebase.messaging.CommonNotificationBuilder.createContentIntent(com.google.firebase:firebase-messaging@@21.0.1:5) 03-28 00:53:06.275 18025 20205 E AndroidRuntime: at com.google.firebase.messaging.CommonNotificationBuilder.createNotificationInfo(com.google.firebase:firebase-messaging@@21.0.1:20) 03-28 00:53:06.275 18025 20205 E AndroidRuntime: at com.google.firebase.messaging.CommonNotificationBuilder.createNotificationInfo(com.google.firebase:firebase-messaging@@21.0.1:6) 03-28 00:53:06.275 18025 20205 E AndroidRuntime: at com.google.firebase.messaging.DisplayNotification.handleNotification(com.google.firebase:firebase-messaging@@21.0.1:4) 03-28 00:53:06.275 18025 20205 E AndroidRuntime: at com.google.firebase.messaging.FirebaseMessagingService.dispatchMessage(com.google.firebase:firebase-messaging@@21.0.1:8) 03-28 00:53:06.275 18025 20205 E AndroidRuntime: at com.google.firebase.messaging.FirebaseMessagingService.passMessageIntentToSdk(com.google.firebase:firebase-messaging@@21.0.1:8) 03-28 00:53:06.275 18025 20205 E AndroidRuntime: at com.google.firebase.messaging.FirebaseMessagingService.handleMessageIntent(com.google.firebase:firebase-messaging@@21.0.1:3) 03-28 00:53:06.275 18025 20205 E AndroidRuntime: at com.google.firebase.messaging.FirebaseMessagingService.handleIntent(com.google.firebase:firebase-messaging@@21.0.1:3) 03-28 00:53:06.275 18025 20205 E AndroidRuntime: at com.google.firebase.messaging.EnhancedIntentService.lambda$processIntent$0$EnhancedIntentService(Unknown Source:1) 03-28 00:53:06.275 18025 20205 E AndroidRuntime: at com.google.firebase.messaging.EnhancedIntentService$$Lambda$0.run(Unknown Source:6) 03-28 00:53:06.275 18025 20205 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137) 03-28 00:53:06.275 18025 20205 E AndroidRuntime: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) 03-28 00:53:06.275 18025 20205 E AndroidRuntime: at com.google.android.gms.common.util.concurrent.zza.run(com.google.android.gms:play-services-basement@@18.1.0:2) 03-28 00:53:06.275 18025 20205 E AndroidRuntime: at java.lang.Thread.run(Thread.java:1012) 03-28 00:53:13.049 19364 19434 E Parcel : Reading a NULL string not supported here.

PrasadFeker avatar Mar 27 '23 19:03 PrasadFeker

I am getting these errors, @mikehardy Can you please help me

PrasadFeker avatar Mar 27 '23 19:03 PrasadFeker

@PrasadFeker so, you must update your software. This was fixed in the underlying SDKs long ago


    "@react-native-firebase/app": "^10.1.1",
    "@react-native-firebase/crashlytics": "^10.1.1",
    "@react-native-firebase/dynamic-links": "^10.1.1",
    "@react-native-firebase/messaging": "^10.1.1",

Those versions do not contain the fix. When you update to current versions, it will work.

mikehardy avatar Mar 27 '23 21:03 mikehardy

Thank you @mikehardy

PrasadFeker avatar Mar 28 '23 09:03 PrasadFeker

@PrasadFeker @mikehardy setBackgroundMessageHandler not working for API level 31 to 33

"@react-native-firebase/analytics": "^17.3.2", "@react-native-firebase/app": "^17.3.2", "@react-native-firebase/messaging": "^17.3.2",

After i upgrade all to package to 17.4.0, even also not working

Akilramki avatar Mar 28 '23 12:03 Akilramki

@Akilramki with no information needed to help, there can be no help. You should investigate adb logcat while an Fcm comes in and post details on your own issue with details on your project showing how to reproduce

mikehardy avatar Mar 29 '23 09:03 mikehardy

@mikehardy We Trigger the Push Notification from Firebase using scedule notification to user, setBackgroundMessageHandler not working particular for API level 31.

"@react-native-firebase/analytics": "^17.3.2", "@react-native-firebase/app": "^17.3.2", "@react-native-firebase/messaging": "^17.3.2",

Akilramki avatar Mar 30 '23 06:03 Akilramki

You should investigate adb logcat on the device targeted by the push as it receives the Fcm....

mikehardy avatar Mar 30 '23 10:03 mikehardy

@mikehardy I am facing issue only in Samsung and xiaomi Mobile and Not getting any log from Firebase using adb logcat

Akilramki avatar Apr 03 '23 05:04 Akilramki

Those two are notorious, http://dontkillmyapp.com

mikehardy avatar Apr 03 '23 11:04 mikehardy

Those two are notorious, http://dontkillmyapp.com

@mikehardy Thank you

Akilramki avatar Apr 03 '23 11:04 Akilramki

Hi @mikehardy , after changing the

"@react-native-firebase/app": "^10.1.1", "@react-native-firebase/crashlytics": "^10.1.1", "@react-native-firebase/dynamic-links": "^10.1.1", "@react-native-firebase/messaging": "^10.1.1",

I changed the versions to the latest, after that i tried to pod install but getting errors, please check attached one Uploading Screenshot 2023-04-06 at 11.26.42 AM.png…

[!] CocoaPods could not find compatible versions for pod "Firebase/Messaging": In snapshot (Podfile.lock): Firebase/Messaging (= 7.6.0, ~> 7.6.0)

In Podfile: RNFBMessaging (from ../node_modules/@react-native-firebase/messaging) was resolved to 17.4.1, which depends on Firebase/Messaging (= 10.7.0)

You have either:

  • out-of-date source repos which you can update with pod repo update or with pod install --repo-update.
  • changed the constraints of dependency Firebase/Messaging inside your development pod RNFBMessaging. You should run pod update Firebase/Messaging to apply changes you've made.

PrasadFeker avatar Apr 06 '23 05:04 PrasadFeker

You have a project-specific error, and the screenshot appears broken (screenshots are discouraged in general, just posting the error is better)

It appears that something is trying to lock firebase-ios-sdk to 7.6.0 but that is a very old version, and we are using 10.7.0 now as described in the error message.

You should try to locate whatever is pinning the firebase-ios-sdk version to 7.6.0 in the Podfile and remove it.

mikehardy avatar Apr 06 '23 21:04 mikehardy

same error, any body have any idea to fix this?

khoand04 avatar Jun 16 '23 10:06 khoand04

This seems to be related to this: https://github.com/firebase/firebase-android-sdk/issues/3115. But how to do i know what sdk the react native package is referencing?

ghost avatar Jun 30 '23 18:06 ghost

Hey @truckeralex - I believe it will print out on the console during android builds which firebase-android-sdk BoM is in use, but we define it here:

https://github.com/invertase/react-native-firebase/blob/e52e24ed0cadaa4ee873c9b286fdc4562ba20a48/packages/app/package.json#L84

It is possible, though most people do not use this feature as it is more of an emergency escape valve for people that know what they are doing and accept the risk of version (mis-)management, for you to manually override the BoM, so if you have done that then you will have to consult your own build files to see https://rnfirebase.io/#android

mikehardy avatar Jul 01 '23 01:07 mikehardy

@khoand04, I fixed this by updating from 11.4.1 to 14.12.0. Somewhere between there the sdk was updated with the fix to support API level 31 as mentioned here: https://github.com/firebase/firebase-android-sdk/issues/3115

ghost avatar Jul 03 '23 18:07 ghost