Firebase invites says invitation sent but not rece

2019-05-29 01:20发布

问题:

I added SHA1 debug and release keys in firebase console still no luck on why the invites are not being sent ?

Im new to firebase invites and implemented as per documentation :

 invitesButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Amplitude.getInstance().logEvent("INVITE EVENT");
                Intent intent = new AppInviteInvitation.IntentBuilder("Invitation")
                        .setMessage("Help your friend unlock his favourite celebrity at FanStation : app link here")
                        .setCustomImage(Uri.parse("https://postimg.org/image/5sbdexljh/"))
                        .setCallToActionText("Unlock Celebrity Now")
                .build();
                startActivityForResult(intent, REQUEST_INVITE);
            }
        });

// My Toast text doesn't appear in either case of success or failure because I get 65537 as request code and -1 as result code

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    Log.d("Invites", "onActivityResult: requestCode=" + requestCode + ", resultCode=" + resultCode);
    Log.d("Invites","requestCode="+requestCode+"resultCode=" + resultCode);

    if (requestCode == REQUEST_INVITE) {
        if (resultCode == RESULT_OK) {
            Amplitude.getInstance().logEvent("INVITE SUCCESS");
            Log.d("Invites","Success");
            Toast.makeText(getActivity(),"Invites Successful",Toast.LENGTH_LONG).show();
        } else {
            Amplitude.getInstance().logEvent("INVITE FAILURE");
            Toast.makeText(getActivity(),"Please Try Again Later",Toast.LENGTH_LONG).show();
        }
    }
}

回答1:

For those of you who enabled Google Play App Signing, you'll also have to add the SHA-1 key from the "App Signing Certificate" to your Firebase console and use the updated google-services.json in order for the invite to work on apps launched to the Google Play Store.

Steps to locate the SHA-1 key: 1) Go to your Google Play Console 2) Select the targeting app 3) Go to "App signing" under "Release management" 4) The SHA-1 key can be found under "App Signing Certificate"

It took me many hours to resolve the issue and I hope this can help someone who runs into the same issue.



回答2:

In my case the solution was add the SHA-256 in firebase console too.

Credits to @Ender in this answer

Hope it helps!