Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[🐛] Bug Report Title - Incorrect Localization of Push Notifications in Background Mode #7992

Closed
3 of 10 tasks
longnguyen2508 opened this issue Aug 27, 2024 · 2 comments
Closed
3 of 10 tasks
Labels
platform: ios plugin: messaging FCM only - ( messaging() ) - do not use for Notifications resolution: solution-provided type: bug New bug report

Comments

@longnguyen2508
Copy link

longnguyen2508 commented Aug 27, 2024

Issue

Description:

The Firebase Cloud Messaging (FCM) is used for sending notifications to devices. Although the title-loc-key and Localizable.strings are used for localizing the content of push notifications, there is an inconsistency with the language displayed

Actual

When the device's language is set to English and the app's preferred language is set to Japanese, the push notifications display in English instead of Japanese while the app is in background mode. The notifications only display in Japanese when the device's language is changed to Japanese.

Device Language: English
App Preferred Language: Japanese

→ Push Notification: English

Expected Behaviour:

The push notifications should display in the app's preferred language, which is Japanese in this case, regardless of the device's default language setting. This should hold even when the app is running in the background, ensuring a consistent user experience in line with the selected in-app language preferences.

Device Language: English
App Preferred Language: Japanese

→ Push Notification: Japanese

Reproduction:

  1. Set the device's language to English.
  2. Set the app's preferred language to Japanese.
  3. Setup Localizable.strings for English and Japanese
// app/ios/en.lproj/Localizable.strings
NOTIFICATION_TITLE_WITH_ARGS = "EN Notification Tile with args: %@";
NOTIFICATION_MESSAGE_WITH_ARGS = "EN Notification Message with args: %@";
// app/ios/ja.lproj/Localizable.strings
NOTIFICATION_TITLE_WITH_ARGS = "JA 引数付き通知のタイトル: %@";
NOTIFICATION_MESSAGE_WITH_ARGS = "JA 引数付き通知のメッセージ: %@";
  1. Send a push notification to the device with the app in background mode with below data:
{
    "message": {
        "token": "{{notificationKey}}",
        "data": {
            "notifee": "{\"title\": \"Notifee title\", \"body\": \"Notifee Body\"}"
        },
        "apns": {
            "payload": {
                "aps": {
                    "alert": {
                        "title-loc-key": "NOTIFICATION_TITLE_WITH_ARGS",
                        "title-loc-args": ["title argument"],
                        "loc-key": "NOTIFICATION_MESSAGE_WITH_ARGS",
                        "loc-args": ["message argument"]
                    }
                }
            }
        }
    }
}
  1. Observe that the notification text is in English, not Japanese.

Project Files

Javascript

Click To Expand

package.json:

{
  "name": "app",
  "version": "0.1.0",
  "private": true,
  "scripts": {},
  "dependencies": {
    "@expo/react-native-action-sheet": "^4.0.1",
    "@gorhom/bottom-sheet": "^4",
    "@hookform/resolvers": "^3.3.4",
    "@invertase/react-native-apple-authentication": "^2.3.0",
    "@kingstinct/react-native-healthkit": "^7.3.2",
    "@notifee/react-native": "^7.8.0",
    "@react-native-async-storage/async-storage": "^1.19.3",
    "@react-native-firebase/app": "^20.4.0",
    "@react-native-firebase/auth": "^20.4.0",
    "@react-native-firebase/firestore": "^20.4.0",
    "@react-native-firebase/functions": "^20.4.0",
    "@react-native-firebase/messaging": "^20.4.0",
    "@react-native-google-signin/google-signin": "^11.0.1",
    "@react-native-picker/picker": "^2.5.0",
    "@react-navigation/bottom-tabs": "^6.5.8",
    "@react-navigation/native": "^6.1.7",
    "@react-navigation/native-stack": "^6.9.13",
    "@shakebugs/react-native-shake": "^16.2.1",
    "@tamagui/animations-react-native": "^1.108.4",
    "@tamagui/babel-plugin": "^1.108.4",
    "@tamagui/config": "^1.108.4",
    "@tamagui/font-inter": "^1.108.4",
    "@tamagui/lucide-icons": "^1.108.4",
    "@tamagui/shorthands": "^1.108.4",
    "@tamagui/themes": "^1.108.4",
    "@types/lodash.unionby": "^4.8.9",
    "@wellbeing/cloudinary": "workspace:^",
    "date-fns": "^3.3.1",
    "i18next": "^23.5.1",
    "intl-pluralrules": "^2.0.1",
    "lodash.capitalize": "^4.2.1",
    "lodash.groupby": "^4.6.0",
    "lodash.isempty": "^4.4.0",
    "lodash.isequal": "^4.5.0",
    "lodash.sortby": "^4.7.0",
    "lodash.unionby": "^4.8.0",
    "lottie-react-native": "^6.7.0",
    "mobx": "^6.10.2",
    "mobx-react-lite": "^4.0.4",
    "mobx-state-tree": "^5.1.8",
    "mst-reference-pool": "^0.2.2",
    "react": "18.3.1",
    "react-hook-form": "^7.49.3",
    "react-i18next": "^13.2.2",
    "react-native": "0.75.2",
    "react-native-blasted-image": "^0.0.13",
    "react-native-bootsplash": "^5.5.3",
    "react-native-config": "^1.5.1",
    "react-native-device-info": "^10.13.2",
    "react-native-element-dropdown": "^2.10.1",
    "react-native-gesture-handler": "^2.16.0",
    "react-native-get-random-values": "^1.11.0",
    "react-native-image-crop-picker": "^0.41.0",
    "react-native-keyboard-manager": "^6.5.11-2",
    "react-native-localization-settings": "^1.0.2",
    "react-native-localize": "^3.1.0",
    "react-native-reanimated": "^3.11.0",
    "react-native-reanimated-carousel": "^3.5.1",
    "react-native-safe-area-context": "^4.10.1",
    "react-native-screens": "^3.31.1",
    "react-native-sha256": "^1.4.10",
    "react-native-svg": "^15.2.0",
    "react-native-toast-message": "^2.1.7",
    "tamagui": "^1.108.4",
    "uuid": "^9.0.1",
    "zod": "^3.22.4"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/plugin-transform-flow-strip-types": "^7.23.3",
    "@babel/preset-env": "^7.20.0",
    "@babel/runtime": "^7.20.0",
    "@react-native/babel-preset": "0.75.2",
    "@react-native/eslint-config": "0.75.2",
    "@react-native/metro-config": "0.75.2",
    "@react-native/typescript-config": "0.75.2",
    "@types/capitalize": "^2.0.2",
    "@types/lodash.groupby": "^4.6.9",
    "@types/lodash.isempty": "^4.4.9",
    "@types/lodash.isequal": "^4.5.8",
    "@types/lodash.sortby": "^4.7.9",
    "@types/react": "^18.2.6",
    "@types/react-test-renderer": "^18.0.0",
    "babel-jest": "^29.6.3",
    "eslint": "^8.50.0",
    "eslint-plugin-json": "^3.1.0",
    "jest": "^29.6.3",
    "metro-react-native-babel-preset": "0.76.8",
    "react-native-monorepo-tools": "^1.2.1",
    "react-test-renderer": "18.3.1",
    "reactotron-core-client": "^2.9.2",
    "reactotron-mst": "^3.1.9",
    "reactotron-react-native": "^5.1.3",
    "typescript": "5.0.4"
  },
  "engines": {
    "node": ">=18"
  }
}

firebase.json for react-native-firebase v6:

{
  "react-native": {
    "messaging_ios_auto_register_for_remote_messages": true
  }
}

iOS

Click To Expand

ios/Podfile:

  • I'm not using Pods
  • I'm using Pods and my Podfile looks like:
# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, min_ios_version_supported
prepare_react_native_project!

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

target 'APP' do
  config = use_native_modules!

  # Altering CocoaPods to use frameworks
  # https://rnfirebase.io/#altering-cocoapods-to-use-frameworks
  use_frameworks! :linkage => :static
  $RNFirebaseAsStaticFramework = true

  use_react_native!(
    :path => config[:reactNativePath],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'APPTests' do
    inherit! :complete
    # Pods for testing
  end

  target 'APPDevelopment' do
    inherit! :complete
  end

  post_install do |installer|
    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false,
      # :ccache_enabled => true
    )
  end
end

AppDelegate.m:

#import "AppDelegate.h"
// Configure Firebase with iOS credentials
// https://rnfirebase.io/#configure-firebase-with-ios-credentials
#import <Firebase.h>

#import <React/RCTBundleURLProvider.h>

// Config Shakebugs
// Refs: https://docs.shakebugs.com/docs/react/users/chat/#creating-a-push-notifications-certificate
#import <Shake/Shake.h>
#import <UserNotifications/UNUserNotificationCenter.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  // Configure Firebase with iOS credentials
  // https://rnfirebase.io/#configure-firebase-with-ios-credentials
  [FIRApp configure];
  
  // Config Shakebugs
  // Refs: https://docs.shakebugs.com/docs/react/users/chat/#creating-a-push-notifications-certificate
  UNUserNotificationCenter.currentNotificationCenter.delegate = self;
  [UIApplication.sharedApplication registerForRemoteNotifications];

  self.moduleName = @"APP";
  // You can add your custom initial props in the dictionary below.
  // They will be passed down to the ViewController used by React Native.
  self.initialProps = @{};

  return [super application:application didFinishLaunchingWithOptions:launchOptions];
}

- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
{
  return [self bundleURL];
}
 
- (NSURL *)bundleURL
{
#if DEBUG
  return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index"];
#else
  return [[NSBundle mainBundle] URLForResource:@"main" withExtension:@"jsbundle"];
#endif
}

// Config Shakebugs
// Refs: https://docs.shakebugs.com/docs/react/users/chat/#creating-a-push-notifications-certificate
- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    [SHKShake didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler {
    if ([SHKShake isShakeNotification:response.notification]){
        [SHKShake reportNotificationCenter:center didReceiveNotificationResponse:response withCompletionHandler:completionHandler];
        return;
    }

    completionHandler();
}
- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler {
    if ([SHKShake isShakeNotification:notification]){
        [SHKShake reportNotificationCenter:center willPresentNotification:notification withCompletionHandler:completionHandler];
        return;
    }


    completionHandler(UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionSound);
}
// End setup for Shakebugs

@end


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 = "34.0.0"
        minSdkVersion = 23
        compileSdkVersion = 34
        targetSdkVersion = 34
        ndkVersion = "26.1.10909125"
        kotlinVersion = "1.9.24"

        // Setup Google Sign in
        // https://react-native-google-signin.github.io/docs/setting-up/android
        googlePlayServicesAuthVersion = "19.2.0" // <--- use this version or newer
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle")
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")

        // Firebase Setup
        // https://rnfirebase.io/#configure-firebase-with-android-credentials
        classpath 'com.google.gms:google-services:4.4.0'
    }
}

apply plugin: "com.facebook.react.rootproject"

android/app/build.gradle:

apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"

// Multiple environments setup
// Ref: https://dasuja.medium.com/multiple-environments-setup-in-react-native-for-android-and-ios-app-29ef5cb4656a
project.ext.envConfigFiles = [
   production: ".env.production",
   development: ".env.development"
]
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
// Firebase Setup
// https://rnfirebase.io/#configure-firebase-with-android-credentials
apply plugin: 'com.google.gms.google-services'

/**
 * This is the configuration block to customize your React Native Android app.
 * By default you don't need to apply any configuration, just uncomment the lines you need.
 */
react {
    /* Folders */
    //   The root of your project, i.e. where "package.json" lives. Default is '../..'
    // root = file("../../")
    //   The folder where the react-native NPM package is. Default is ../../node_modules/react-native
    reactNativeDir = file("../../../../node_modules/react-native")
    //   The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
    codegenDir = file("../../../../node_modules/@react-native/codegen")
    //   The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
    cliFile = file("../../../../node_modules/react-native/cli.js")

    /* Variants */
    //   The list of variants to that are debuggable. For those we're going to
    //   skip the bundling of the JS bundle and the assets. By default is just 'debug'.
    //   If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
    // debuggableVariants = ["liteDebug", "prodDebug"]

    /* Bundling */
    //   A list containing the node command and its flags. Default is just 'node'.
    // nodeExecutableAndArgs = ["node"]
    //
    //   The command to run when bundling. By default is 'bundle'
    // bundleCommand = "ram-bundle"
    //
    //   The path to the CLI configuration file. Default is empty.
    // bundleConfig = file(../rn-cli.config.js)
    //
    //   The name of the generated asset file containing your JS bundle
    // bundleAssetName = "MyApplication.android.bundle"
    //
    //   The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
    // entryFile = file("../js/MyApplication.android.js")
    //
    //   A list of extra flags to pass to the 'bundle' commands.
    //   See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
    // extraPackagerArgs = []

    /* Hermes Commands */
    //   The hermes compiler command to run. By default it is 'hermesc'
    hermesCommand = "../../node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc"
    //
    //   The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
    // hermesFlags = ["-O", "-output-source-map"]

    /* Autolinking */
    autolinkLibrariesWithApp()
}

/**
 * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
 */
def enableProguardInReleaseBuilds = false

/**
 * The preferred build flavor of JavaScriptCore (JSC)
 *
 * 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:+'

android {
    ndkVersion rootProject.ext.ndkVersion

    buildToolsVersion rootProject.ext.buildToolsVersion
    compileSdk rootProject.ext.compileSdkVersion

    // Multiple environments setup
        // Ref: https://dasuja.medium.com/multiple-environments-setup-in-react-native-for-android-and-ios-app-29ef5cb4656a
    flavorDimensions "default"
    productFlavors {
        development {
            minSdkVersion rootProject.ext.minSdkVersion
            applicationId "com.example.appdevelopment"
            targetSdkVersion rootProject.ext.targetSdkVersion
        }
        production {
            minSdkVersion rootProject.ext.minSdkVersion
            applicationId "com.example.app"
            targetSdkVersion rootProject.ext.targetSdkVersion
        }
    }

    namespace "com.example.app"
    defaultConfig {
        applicationId "com.example.app"
        minSdkVersion rootProject.ext.minSdkVersion
        targetSdkVersion rootProject.ext.targetSdkVersion
        versionCode 108
        versionName "0.19.1"

        // Multiple environments setup
        // Ref: https://dasuja.medium.com/multiple-environments-setup-in-react-native-for-android-and-ios-app-29ef5cb4656a 
        resValue "string", "build_config_package", "com.example.app"
    }
    signingConfigs {
        debug {
            storeFile file('debug.keystore')
            storePassword 'XXX'
            keyAlias 'XXX'
            keyPassword 'XXX'
        }
        release {
            // Ref: https://reactnative.dev/docs/signed-apk-android
            // How to use .env https://github.com/lugg/react-native-config/issues/314#issuecomment-493704625
            storeFile file(project.env.get('APP_RELEASE_STORE_FILE'))
            storePassword project.env.get('APP_RELEASE_STORE_PASSWORD')
            keyAlias project.env.get('APP_RELEASE_KEY_ALIAS')
            keyPassword project.env.get('APP_RELEASE_KEY_PASSWORD')
        }
    }
    buildTypes {
        debug {
            signingConfig signingConfigs.debug

            // Multiple environments setup
            // Ref: https://dasuja.medium.com/multiple-environments-setup-in-react-native-for-android-and-ios-app-29ef5cb4656a 
            matchingFallbacks = ['debug', 'release']
        }
        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"
        }
    }
}

dependencies {
    // The version of react-native is set by the React Native Gradle Plugin
    implementation("com.facebook.react:react-android")

    if (hermesEnabled.toBoolean()) {
        implementation("com.facebook.react:hermes-android")
    } else {
        implementation jscFlavor
    }
    // Firebase Setup
    // https://rnfirebase.io/#configure-firebase-with-android-credentials
    implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0' // <-- add this; newer versions should work too
}

// Firebase Setup
// https://rnfirebase.io/#configure-firebase-with-android-credentials
apply plugin: 'com.google.gms.google-services' // <--- this should be the last line

android/settings.gradle:

pluginManagement { includeBuild("../../../node_modules/@react-native/gradle-plugin") }
plugins { id("com.facebook.react.settings") }
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
rootProject.name = 'APP'
include ':app'
includeBuild('../../../node_modules/@react-native/gradle-plugin')

MainApplication.kt:

package com.example.app

import android.app.Application
import com.facebook.react.PackageList
import com.facebook.react.ReactApplication
import com.facebook.react.ReactHost
import com.facebook.react.ReactNativeHost
import com.facebook.react.ReactPackage
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.soloader.SoLoader

class MainApplication : Application(), ReactApplication {

  override val reactNativeHost: ReactNativeHost =
      object : DefaultReactNativeHost(this) {
        override fun getPackages(): List<ReactPackage> =
            PackageList(this).packages.apply {
              // Packages that cannot be autolinked yet can be added manually here, for example:
              // add(MyReactNativePackage())
            }

        override fun getJSMainModuleName(): String = "index"

        override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG

        override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
        override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
      }

  override val reactHost: ReactHost
    get() = getDefaultReactHost(applicationContext, reactNativeHost)

  override fun onCreate() {
    super.onCreate()
    SoLoader.init(this, false)
    if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
      // If you opted-in for the New Architecture, we load the native entry point for this app.
      load()
    }
  }
}

AndroidManifest.xml:

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

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <application
      android:name=".MainApplication"
      // Setup Preferred Language
      // Ref: https://github.com/jakex7/react-native-localization-settings?tab=readme-ov-file#android
      android:localeConfig="@xml/locales_config"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false"
      android:theme="@style/AppTheme"
      android:supportsRtl="true">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:screenOrientation="portrait"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize"
        android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
    </application>
</manifest>


Environment

Click To Expand

react-native info output:

System:
  OS: macOS 14.5
  CPU: (11) arm64 Apple M3 Pro
  Memory: 166.84 MB / 18.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 21.6.1
    path: ~/.nvm/versions/node/v21.6.1/bin/node
  Yarn:
    version: 3.6.4
    path: ~/.nvm/versions/node/v21.6.1/bin/yarn
  npm:
    version: 10.2.4
    path: ~/.nvm/versions/node/v21.6.1/bin/npm
  Watchman:
    version: 2024.08.19.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/hc794/.gem/ruby/3.3.0/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.5
      - iOS 17.5
      - macOS 14.5
      - tvOS 17.5
      - visionOS 1.2
      - watchOS 10.5
  Android SDK:
    API Levels:
      - "28"
      - "33"
      - "34"
    Build Tools:
      - 30.0.3
      - 33.0.0
      - 34.0.0
    System Images:
      - android-34 | Google APIs ARM 64 v8a
      - android-35 | Google Play Experimental 16k Page Size ARM 64 v8a
      - android-35 | Pre-Release 16 KB Page Size Google APIs ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2023.3 AI-233.14808.21.2331.11709847
  Xcode:
    version: 15.4/15F31d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.11
    path: /Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home/bin/javac
  Ruby:
    version: 3.3.0
    path: /Users/hc794/.rubies/ruby-3.3.0/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react: Not Found
  react-native: Not Found
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false
  • Platform that you're experiencing the issue on:
    • 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:
    • 20.4.0
  • Firebase module(s) you're using that has the issue:
    • Messaging
  • Are you using TypeScript?
    • Y & 5.0.4


@russellwheatley
Copy link
Member

As far as I'm aware, push notifications will fall back to using the device's language when the app is in the background. Hence why you're seeing this inconsistency. To get around this iOS design choice, it might be worth storing the apps preferred language on the server so the push notification is sent in the correct language without relying on the app being active.

@russellwheatley russellwheatley added platform: ios plugin: messaging FCM only - ( messaging() ) - do not use for Notifications resolution: solution-provided and removed Needs Attention labels Aug 27, 2024
@longnguyen2508
Copy link
Author

Thank you 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: ios plugin: messaging FCM only - ( messaging() ) - do not use for Notifications resolution: solution-provided type: bug New bug report
Projects
None yet
Development

No branches or pull requests

4 participants
@russellwheatley @longnguyen2508 and others