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

🔥[🐛] [expo][plugin] Does not add the Background Modes capabilities

Open AntoineThibi opened this issue 2 years ago • 1 comments

Issue

The current documentation of react-native-firebase/messaging suggests enabling Background Modes capabilities for iOS as part of the setup process (see iOS Setup). However, when integrating the @react-native-firebase/messaging plugin via Expo, the Background Modes are not automatically added.

Expected Behavior:

The documentation or the config plugin should align with the actual behavior of the package when used with Expo. If the Expo plugin @react-native-firebase/messaging does not automatically handle the addition of Background Modes, this discrepancy should be clearly mentioned in the documentation, along with guidance on how to manually set up Background Modes for iOS when using Expo.

Steps to Reproduce:

Follow the instructions for setting up react-native-firebase/messaging on iOS as per the official documentation. Add the @react-native-firebase/messaging plugin via Expo. Observe that backgroundModes are not added automatically as part of this process.

Suggested Solution:

Best solution : updating the expo plugin to add those Background modes (if you agree with the issue, I can make a PR to add it)

Quick fix : changing the documentation, to also tell the user to add these capabilities :

// app.json
{
  "expo": {
    "ios": {
      "infoPlist": {
        "UIBackgroundModes": ["fetch", "remote-notification"]
      }
    }
  }
}

Project Files

// app.json

{
  "expo": {
    "android": {
      "googleServicesFile": "./google-services.json"
    },
    "ios": {
      "googleServicesFile": "./GoogleService-Info.plist"
    },
    "plugins": [
      "@react-native-firebase/app",
      "@react-native-firebase/messaging",
    ]
  }
}

Javascript

Click To Expand

package.json:

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

firebase.json for react-native-firebase v6:

# N/A

iOS

Click To Expand

ios/Podfile:

  • [ ] I'm not using Pods
  • [x] I'm using Pods and my Podfile looks like:
# N/A

AppDelegate.m:

// 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:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->

Environment

Click To Expand

Expo SDK: 49

react-native info output:

 OUTPUT GOES HERE
  • 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:
    • e.g. 5.4.3
  • Firebase module(s) you're using that has the issue:
    • e.g. Instance ID
  • Are you using TypeScript?
    • Y/N & VERSION

AntoineThibi avatar Jan 18 '24 10:01 AntoineThibi

Hi there - with apologies - we do have Expo support in the repo but it is community-provided. I do not personally use Expo so I will not be able to help here.

Hopefully someone that uses this library + Expo can step in to offer a solution

mikehardy avatar Jan 24 '24 12:01 mikehardy

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.

github-actions[bot] avatar Feb 21 '24 12:02 github-actions[bot]