0

I've gone through the steps to setup App Invites as described here.

Out of curiosity, I tried without including the google-services.json and it still works depending upon the configuration in Google Developer Console.

If there is no Android API key (or there is an Android API key but no package restrictions) then App Invites works (by "works" I mean is able to send the invite message - I haven't tested the other features such as referrals). If API key package restrictions are defined then those rules are obeyed.

UPDATE: Try this scenario - No Api Keys defined, Two OAuth 2.0 client IDs - one for release, one for debug. Then App Invites can send messages in both release and debug builds without any need for the json file.

Is this all expected behaviour? What benefits does including the json file bring?

Mark
  • 6,484
  • 4
  • 48
  • 63

2 Answers2

1

For detailed information about the inner workings of google-services gradle-plugin see my other answer:

https://stackoverflow.com/a/33083898/433421

Community
  • 1
  • 1
arne.jans
  • 3,556
  • 2
  • 19
  • 26
  • Thank you. This explains that the .json is not necessary. But it would be good to know precisely which (if any) generated code is required by App Invites. – Mark Oct 13 '15 at 06:49
-1

I presume you are testing it on your own device. The thing is it'll work as long as you are using adb and uploading directly to your device but in order for it to work on other devices after releasing an apk, you would need to generate an sha key from your release keystore, and also include the google-services.json

Jai Saxena
  • 235
  • 2
  • 14
  • I have tried this on two devices with the same results. How does installing via adb vs. installing via some other means make a difference? Note - I'm only talking about release builds here. – Mark Sep 26 '15 at 09:39
  • Doesn't matter on how many devices you try, if you're installing it using adb, it'll work fine. Have you tried generating an apk and installing from that apk? Try it. – Jai Saxena Sep 26 '15 at 09:49
  • When I said via adb, I meant adb install myapp.apk. The apk generated is release build type. Are you suggesting, the app will behave differently compared to copying the same apk to the device via some other means and installing from there!? – Mark Sep 26 '15 at 09:52
  • Yes, when you release an app, you generate a "signed apk", which uses your keystore password to generate the apk. That keystore has a unique sha signature for which you'll need to generate google-services.json file. Have you tried installing from your signed apk? – Jai Saxena Sep 26 '15 at 09:59
  • That's exactly what I've been talking about the whole time. All APKs are signed. The debug apk is signed with a debug key. The release apk is signed with the release key. We've both been talking about release builds, but you've been thinking I've been talking about debug builds. – Mark Sep 26 '15 at 10:05