user3057944 user3057944 - 1 month ago 15
Android Question

Gcm for debug build on Android

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}" />

AL. AL.
Answer

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.

Comments