7

I'm trying to get Firebase invitations working. I've followed the instructions here.

The code that fires off the invitation process is as follows

        AppInviteInvitation.IntentBuilder intentBuilder = new AppInviteInvitation.IntentBuilder(LanguageManager.getString("title-Invitation"))
                .setMessage(LanguageManager.formatString("message-INVITATION_{game-name}", ScribbleGame.getGame().getDisplayName()))
                .setEmailSubject(LanguageManager.formatString("title-TRY_{game_name}", ScribbleGame.getGame().getDisplayName()))
                .setEmailHtmlContent(emailHtml);

        application.startActivityForResult(intentBuilder.build(), ActivityResultConstants.REQUEST_INVITE);

The email contains a link inserted using the %%APPINVITE_LINK_PLACEHOLDER%% tag. The invitations are sent as expected.

I've tried both with and without deep links. Without deep links, I get a URL like this, which doesn't work and returns a 404 error.

https://plus.google.com/appinvite/131189621476-3ec41294-23ea-47e7-81d7-9a5fd004de6e

With deep links, I get a URL like this, which doesn't work and returns a 500 error.

https://sfqj5.app.goo.gl/i/131189621476-b6d8a1cf-81b4-4318-90d0-c32ee1a945e1

I've done a lot of digging but have failed to establish why the links aren't working.

Will Calderwood
  • 4,393
  • 3
  • 39
  • 64

3 Answers3

1

In my case I have to set deep link while build invitation intent. I use default link, which I got from firebase console.

cant upload screenshot for some reason, so it's link to imgur

mohax
  • 4,435
  • 2
  • 38
  • 85
  • In the question it says "With deep links, I get a URL like this, which doesn't work and returns a 500 error." – Will Calderwood Sep 14 '17 at 20:11
  • @Will Calderwood, I found this question while try without deepLink as I get 404 as mentioned in question. So my answers solves case with no deepLink only. I dont now reason of error in second case, but for me this answer is useful – mohax Sep 14 '17 at 21:13
  • May be there is issue with not setting SHA in console or not updated google-services.json or your app doesnt released in PlayMarket – mohax Sep 14 '17 at 21:15
1

I got the same 404 error and finally fix it by calling AppInviteInvitation.IntentBuilder.setDeepLink().

For details, please visit https://firebase.google.com/docs/invites/android

Even you are using play-services-appinvite, you still have to add your project to Firebase and get the deeplink uri from firebase console. Following step 1, 2 and 3 of "Before you begin", it works for my apps.

Sam Lu
  • 3,448
  • 1
  • 27
  • 39
0

Put setDeepLink() method in Intent builder. It solved my error.

val intent = AppInviteInvitation.IntentBuilder(getString(R.string.invite_friends_title))
                                .setMessage(getString(R.string.invite_friends_message))
                                .setDeepLink(Uri.parse("https://"))
                                .setOtherPlatformsTargetApplication(
                                        AppInviteInvitation.IntentBuilder.PlatformMode.PROJECT_PLATFORM_IOS,
                                        "311303977939-11h8u454au9q1ts1mleiat83v2r2cd5n.apps.googleusercontent.com")
                                .build()
AS Mackay
  • 2,831
  • 9
  • 19
  • 25