3

Is it possible to register different build variant of my app (release and debug) on GCM (it seems to me, I have migrate to Firebase Messaging, but I think the solution is the same)? When I registered my app, I get a google-service.json, and a server-key. I sent the server key to backend developers, and included the json in my project. Should I generate another json for debug build with project name "com.example.myapp.debug" (if my release build "com.example.myapp") and send this server key to backend devs too? Is this is the solution, I still don't know where to put the json for different builds. And my other question, what about GcmReceiver. I added

<action android:name="com.exmple.myapp />

should I replace this with

<action android:name="${applicationId}" />
user3057944
  • 701
  • 1
  • 8
  • 19
  • Were you able to try out configuring build variants as per my answer? Or were you aiming for something else? – AL. Oct 28 '16 at 13:25

2 Answers2

1

I would suggest for you to create and use two separate projects for debug and release version, in order to avoid getting a mix-up when sending messages (i.e. accidental push to live devices while testing).

Not directly related, but the stated description mentioned in the GCM CCS docs gives you an idea of what I'm trying to say.

However, on a totally related note, as per my answer here:

You could create a new product flavor for your app (e.g. "development") (Configure Build Variants) and create a seperate firebase project (with a seperate google-services.json file) (Add multiple google-services.json files).

Then you have different API keys for each project which don't effect each other.

Community
  • 1
  • 1
AL.
  • 36,815
  • 10
  • 142
  • 281
0

No need to create different google-service.json files. Add your main package name and create one. it will work both build and release version

Ishan Fernando
  • 2,758
  • 1
  • 31
  • 38
  • Thanks, it works now on all of my build, I'd like to separate them. Now I send debug messages to a debug channel, and release messages to news chanell, but I'd like to send all messages to news channel but with different server. – user3057944 Oct 27 '16 at 09:04