Skip to content

UIBackgroundModes overwritten #378

@welenofsky

Description

@welenofsky

I am working on a project that includes radar and firebase, but I am running into an issue where the remote-notifications UIBackgroundMode is being overwritten by the radar expo plugin.

I have set up radar and used the expo plugin configuration example from the documentation. Specifically related to the issue, I am setting iosBackgroundMode to true as I require background location for my project.

I am also using firebase for notifications. This issue is not specific to firebase but it is a good example of a real world issue that I am encountering. Firebase in their documentation tells me to add "remote-notifcation" to my expo config expo.ios.infoPlist.UIBackgroundModes. But the remote-notification UIBackgroundMode is being overwritten by the radar plugin.

if (args.iosBackgroundMode) {
config.modResults.UIBackgroundModes = ["location", "fetch"];
}

I believe this line ^ should instead maybe merge with existing UIBackgroundModes array instead of overwriting/setting it to a new array. That way, it does not overwrite other plugins or custom configuratio options set by user in their expo config.

To recreate/test this, create a new expo application, include radar SDK, then set your expo app.json to something like this. In this example, I am setting some UIBackgroundModes via infoPlist.

{
  "expo": {
    "ios": {
      "infoPlist": {
        "UIBackgroundModes": [
          "location",
          "remote-notification",
          "fetch"
        ]
      },
    "plugins": [
      [
        "react-native-radar",
        {
          "iosBackgroundMode": true
        }
      ]
    ]
  }
}

What you will see after a expo prebuild --clean is that the Info.plist will not contain the 'remote-notification' UIBackgroundMode/entitlement. It should include at a minimum all three specified in my expo config.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions