6

I am trying to implement AppInvites. I have gone through all steps written here https://firebase.google.com/docs/invites/android

And constantly get RESULT_CODE = 3, what have I done wrong?

filipp.kowalski
  • 5,495
  • 7
  • 27
  • 45

1 Answers1

9

Just to be sure it's not your code, you can download Firebase's quickstart samples from here: https://github.com/firebase/quickstart-android. Make sure to update the app-level gradle file with the right package name.

The guide you followed is a little incomplete, and doesn't explicitly mention the need to provide your app's SHA1 key when setting up your project in the Firebase console. Here's how to add the SHA1 key for a release certificate and a debug certificate to an existing Firebase project:

How to find the SHA1 for your keystore:

  1. In command prompt, navigate to your Java installation. You'll be using Java's built-in keystore utility.
  2. For the release certificate, type the following:

    keytool -exportcert -list -v -alias <your-key-name> -keystore <path-to-production-keystore>
    

    Note the SHA1 key it provides.

  3. For the debug certificate, type the following:

    keytool -exportcert -list -v -alias androiddebugkey -keystore %USERPROFILE%\.android\debug.keystore
    

    Again, note the SHA1 key it provides. Since this key is unique to each Android development environment, feel free to repeat this step for each environment you want to build from.

Once your have your SHA1 keys, enter them both into your Firebase project:

  1. Go to your Firebase console.
  2. Click on the three overflow dots on the project in question and click "Manage".
  3. Click SHA1 and enter your first key.
  4. Click SHA1 again and enter your second key.

From there, you just need to download the new google-services.json file and add it to your project's /app directory.

Zira
  • 202
  • 2
  • 5
  • Thanks, great idea with the project. I will try this. Intresting fact is that in my previous app I had AppInvites implemented - it worked then, but when Firebase was released it stopped working – filipp.kowalski Jun 19 '16 at 11:16
  • Thankfully it uses the same exact api so we don't need to change anything in code (except for the Gradle settings). – Zira Jun 19 '16 at 18:29
  • I have added the SHA1 key, but still get the same error and and alert dialog box redirecting me here. – Ari Dec 23 '16 at 05:20
  • ```Create invitations failed due to error code: 3 Client not found for app type: ANDROID package_name: "de.xonatec.choices" certificate_hash: "..." (APPINVITE_CLIENT_ID_ERROR)``` Where can I find the client id? In the google-services.json there are multiple but none of them works. – MarcS82 May 12 '17 at 14:40
  • Where are you entering the client id? – Zira May 12 '17 at 22:23