Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 29612

google-services.json firebase notifications react native android - one app not working

$
0
0

I have three different react-native android apps in a firebase project I use for push notifications. Two of them are working just fine. The third isn't working and I can't figure out what I've done differently.

Here's what I know so far:

  • I get no error in app number three, but push notifications on android just never happen even though I can see in the log that the function has been triggered to schedule the notification.

  • These are 3 pretty similar apps and I'm using react-native-push-notification in all of them.

  • Push notifications on ios are already working in this project.

  • If I copy and paste content from the google-services.json in either of the two working examples and use it to replace the content of google-services.json in the non-working example then push notifications trigger properly on my android emulator.

  • The copy and paste trick is not a solution because after running react-native-bundle, attempting to run the app on android will fail because:

     What went wrong:
     Execution failed for task ':app:processDebugGoogleServices'.
     > No matching client found for package name 'com.appNumberThreeName'
  • Going and manually changing the app name from the name of the app I copied from to the name of the third app will get rid of this error but then I wind up right back where I started. I get no error but the notification just never happens.

  • It seems to me that I somehow did something different in the firebase console for the third app but I can't figure out what. I enter the project, click the plus sign a the top to add an app, select android, and go through the four steps. Step number four (syncing) never completes for app 3 unless I do the copy and paste trick.

  • I've tried starting a new project in firebase and adding the app to that one instead and I wind up with the exact same problem.

  • I have gone through bitbucket to double check all the files I changed in the working examples when I added push notifications to them and to verify that what I've done in the non working project is identical. The only difference is the google-services.json files, which makes me think I did something wrong in the firebase console.

  • Here are examples of google-services.json files that are working and not working with sensitive info replaced with XXXXX or some wording to indicate which app it's referring to:

1. Working App One

{
  "project_info": {
    "project_number": "XXXXX",
    "firebase_url": "XXXXX",
    "project_id": "XXXXX",
    "storage_bucket": "XXXXX"
  },
  "client": [
    {
      "client_info": {
        "mobilesdk_app_id": "XXXXX",
        "android_client_info": {
          "package_name": "appOneName"
        }
      },
      "oauth_client": [
        {
          "client_id": "XXXXX",
          "client_type": 1,
          "android_info": {
            "package_name": "appOneName",
            "certificate_hash": "XXXXX"
          }
        },
        {
          "client_id": "XXXXX",
          "client_type": 3
        }
      ],
      "api_key": [
        {
          "current_key": "XXXXX"
        }
      ],
      "services": {
        "appinvite_service": {
          "other_platform_oauth_client": [
            {
              "client_id": "XXXXX",
              "client_type": 3
            },
            {
              "client_id": "XXXXX",
              "client_type": 2,
              "ios_info": {
                "bundle_id": "appOneBundle",
                "app_store_id": "XXXXX"
              }
            }
          ]
        }
      }
    }
  ],
  "configuration_version": "1"
}

2. Working App Two

{   "project_info": {
    "project_number": "XXXXXX",
    "firebase_url": "XXXXX",
    "project_id": "XXXXX",
    "storage_bucket": "XXXXXX"   },   "client": [
    {
      "client_info": {
        "mobilesdk_app_id": "XXXXX",
        "android_client_info": {
          "package_name": "appOneName"
        }
      },
      "oauth_client": [
        {
          "client_id": "XXXX",
          "client_type": 1,
          "android_info": {
            "package_name": "appOneName",
            "certificate_hash": "XXXXXX"
          }
        },
        {
          "client_id": "XXXXX",
          "client_type": 3
        }
      ],
      "api_key": [
        {
          "current_key": "XXXXX"
        }
      ],
      "services": {
        "appinvite_service": {
          "other_platform_oauth_client": [
            {
              "client_id": "XXXXX",
              "client_type": 3
            },
            {
              "client_id": "XXXXX",
              "client_type": 2,
              "ios_info": {
                "bundle_id": "appOneBundle",
                "app_store_id": "XXXXX"
              }
            }
          ]
        }
      }
    },
    {
      "client_info": {
        "mobilesdk_app_id": "XXXXX",
        "android_client_info": {
          "package_name": "appTwoName"
        }
      },
      "oauth_client": [
        {
          "client_id": "XXXXXX",
          "client_type": 3
        }
      ],
      "api_key": [
        {
          "current_key": "XXXXXXX"
        }
      ],
      "services": {
        "appinvite_service": {
          "other_platform_oauth_client": [
            {
              "client_id": "XXXXX",
              "client_type": 3
            },
            {
              "client_id": "XXXXX",
              "client_type": 2,
              "ios_info": {
                "bundle_id": "appOneBundle",
                "app_store_id": "XXXXX"
              }
            }
          ]
        }
      }
    }   ],   "configuration_version": "1" }

3. Not Working App Three

{
  "project_info": {
    "project_number": "XXXXX",
    "firebase_url": "XXXXX",
    "project_id": "XXXXX",
    "storage_bucket": "XXXXX"
  },
  "client": [
    {
      "client_info": {
        "mobilesdk_app_id": "XXXXX",
        "android_client_info": {
          "package_name": "appThreePackageName"
        }
      },
      "oauth_client": [
        {
          "client_id": "XXXXX",
          "client_type": 3
        }
      ],
      "api_key": [
        {
          "current_key": "XXXXXX"
        }
      ],
      "services": {
        "appinvite_service": {
          "other_platform_oauth_client": [
            {
              "client_id": "XXXXX",
              "client_type": 3
            },
            {
              "client_id": "XXXXX",
              "client_type": 2,
              "ios_info": {
                "bundle_id": "appOneBundleId",
                "app_store_id": "XXXXXX"
              }
            }
          ]
        }
      }
    },
    {
      "client_info": {
        "mobilesdk_app_id": "XXXXX",
        "android_client_info": {
          "package_name": "appOneName"
        }
      },
      "oauth_client": [
        {
          "client_id": "XXXXX",
          "client_type": 1,
          "android_info": {
            "package_name": "appOneName",
            "certificate_hash": "XXXXXX"
          }
        },
        {
          "client_id": "XXXX",
          "client_type": 3
        }
      ],
      "api_key": [
        {
          "current_key": "XXXXXX"
        }
      ],
      "services": {
        "appinvite_service": {
          "other_platform_oauth_client": [
            {
              "client_id": "XXXXX",
              "client_type": 3
            },
            {
              "client_id": "XXXXX",
              "client_type": 2,
              "ios_info": {
                "bundle_id": "appOneBundle",
                "app_store_id": "XXXXX"
              }
            }
          ]
        }
      }
    },
    {
      "client_info": {
        "mobilesdk_app_id": "XXXXXX",
        "android_client_info": {
          "package_name": "com.test" //just a random extra app I added for testing
        }
      },
      "oauth_client": [
        {
          "client_id": "XXXXXXXX",
          "client_type": 3
        }
      ],
      "api_key": [
        {
          "current_key": "XXXXX"
        }
      ],
      "services": {
        "appinvite_service": {
          "other_platform_oauth_client": [
            {
              "client_id": "XXXXX",
              "client_type": 3
            },
            {
              "client_id": "XXXXXX",
              "client_type": 2,
              "ios_info": {
                "bundle_id": "appOneBundle",
                "app_store_id": "XXXXXX"
              }
            }
          ]
        }
      }
    },
    {
      "client_info": {
        "mobilesdk_app_id": "XXXXXXX",
        "android_client_info": {
          "package_name": "appTwoName"
        }
      },
      "oauth_client": [
        {
          "client_id": "XXXXXX",
          "client_type": 3
        }
      ],
      "api_key": [
        {
          "current_key": "XXXXXX"
        }
      ],
      "services": {
        "appinvite_service": {
          "other_platform_oauth_client": [
            {
              "client_id": "XXXXXX",
              "client_type": 3
            },
            {
              "client_id": "XXXXXX",
              "client_type": 2,
              "ios_info": {
                "bundle_id": "appOneBundle",
                "app_store_id": "XXXXX"
              }
            }
          ]
        }
      }
    }
  ],
  "configuration_version": "1"
}

Any suggestions of what to look into would be welcomed - thanks!


Viewing all articles
Browse latest Browse all 29612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>