Advertisement
stevekamau

Untitled

Jan 21st, 2017
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.85 KB | None | 0 0
  1. // [START get_deep_link]
  2.         // Check if this app was launched from a deep link. Setting autoLaunchDeepLink to true
  3.         // would automatically launch the deep link if one is found.
  4.         boolean autoLaunchDeepLink = false;
  5.         AppInvite.AppInviteApi.getInvitation(client2, this, autoLaunchDeepLink)
  6.                 .setResultCallback(
  7.                         new ResultCallback<AppInviteInvitationResult>() {
  8.                             @Override
  9.                             public void onResult(@NonNull AppInviteInvitationResult result) {
  10.                                 if (result.getStatus().isSuccess()) {
  11.                                     // Extract deep link from Intent
  12.                                     Intent intent = result.getInvitationIntent();
  13.                                     String deepLink = AppInviteReferral.getDeepLink(intent);
  14.                                     Log.d("invite_code", deepLink);
  15.                                     Intent i = new Intent(getApplicationContext(), Referral.class);
  16.                                     startActivity(i);
  17.                                     // Handle the deep link. For example, open the linked
  18.                                     // content, or apply promotional credit to the user's
  19.                                     // account.
  20.  
  21.                                     // [START_EXCLUDE]
  22.                                     // Display deep link in the UI
  23.                                     //((TextView) findViewById(R.id.link_view_receive)).setText(deepLink);
  24.                                     // [END_EXCLUDE]
  25.                                 } else {
  26.                                     Log.d("firebase_invite", "getInvitation: no deep link found.");
  27.                                 }
  28.                             }
  29.                         });
  30.         // [END get_deep_link]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement