androidgoogle-app-invites

Result Code 3 when implementing AppInvites


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?


Solution

  • 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.