Does Firebase Cloud Messaging depend on the packag

2019-08-14 14:26发布

I want to know if package name, defined on Firebase project console, is tightly related to Firebase Cloud Message successful delivery or it's just a helper for creating google-services.json file.

On Firebase console, once created it can't be renamed.

In my case I created a project at Firebase console named, by mistake, son.example.firecm instead of com.example.firecm as defined on my Android Studio Project.

My Android project was not compiling cause gap on spelling at google-services.json.

Once renamed package name to com.example.firecm, it compiled but not sure if it will receive Firebase Cloud Messages or not cause difference between Firebase console project package definition at Android Studio project.

3条回答
Root(大扎)
2楼-- · 2019-08-14 14:57

Having the right package name is important for several services, though not FCM specifically, other than getting it right in the google-services.json as you found. FCM uses the project number to identify the app, which will be read from the JSON file.

The best thing to do is just to connect a new Android app to your Firebase project with the correct package name, and download the updated google-services.json. It wont hurt to have the other package name connected (and once the console allows deleting connected apps, you should be able to remove it).

查看更多
对你真心纯属浪费
3楼-- · 2019-08-14 15:05

Well I did further research on the same.

I found that if package name defined on Firebase Console isn't the same as defined on Gradle and Manifest of the APP, then the APP won't be able to receive Notifications sent from Firebase Console.

In guess that in some way it's logic that package name must match in order to Android lunch the correct APP once notification arrives.

To sumarize, it's mandatory that both names matches.

I invite to test by yourself and keep and eye on package names for project success.

查看更多
Lonely孤独者°
4楼-- · 2019-08-14 15:06

in Android studio 2.3.1 it's automatically updated using the firebase option.

Just click Tools->Firebase and select which service is required for your app and it pop up the dialog like below and sync it so in console updating that information .

enter image description here

查看更多
登录 后发表回答