Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Let's your users share your App with Friends: A...

WillyShakes
December 04, 2015

Let's your users share your App with Friends: App Invites for Android

Thinking about free marketing ? Want to give the opportunity to your user to share your app with their friends ? Maybe you just need more downloads ? Not sure where to start? Android App Invite is one of the answer you were looking for.
You will learn more about app invite is all about and why you need to care about. This talk will teach you exactly what you need to know to integrate app invite in your application.
At the end of this class, you will learn how to:

- integrate app invite in your app
- test your app invite for sending and reception of invites
- Manage invites tracking using Google Analytics API

WillyShakes

December 04, 2015
Tweet

More Decks by WillyShakes

Other Decks in Programming

Transcript

  1. Code 1. Connect Google Client API with APP Invite Service

    Enabled 2. Start App Invite Intent 3. handle the result in the callback 4. Check if someone installed the app from an invitation
  2. private void onInviteClicked() { Intent intent = new AppInviteInvitation.IntentBuilder(getString(R.string.invitation_title)) .setMessage(getString(R.string.invitation_message))

    .setDeepLink(Uri.parse(getString(R.string.invitation_deep_link))) .setCustomImage(Uri.parse(getString(R.string.invitation_custom_image))) .setCallToActionText(getString(R.string.invitation_cta)) .build(); startActivityForResult(intent, REQUEST_INVITE); }
  3. private void onInviteClicked() { Intent intent = new AppInviteInvitation.IntentBuilder(getString(R.string.invitation_title)) .setMessage(getString(R.string.invitation_message))

    .setDeepLink(Uri.parse(getString(R.string.invitation_deep_link))) .setCustomImage(Uri.parse(getString(R.string.invitation_custom_image))) .setCallToActionText(getString(R.string.invitation_cta)) .build(); startActivityForResult(intent, REQUEST_INVITE); }
  4. protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode,

    resultCode, data); Log.d(TAG, "onActivityResult: requestCode=" + requestCode + ", resultCode=" + resultCode); if (requestCode == REQUEST_INVITE) { if (resultCode == RESULT_OK) { String[] ids = AppInviteInvitation.getInvitationIds(resultCode, data); Log.d(TAG, getString(R.string.sent_invitations_fmt, ids.length)); } else { showMessage(getString(R.string.send_failed)); } } }
  5. protected void onCreate(Bundle savedInstanceState) { boolean autoLaunchDeepLink = true; AppInvite.AppInviteApi.getInvitation(mGoogleApiClient,

    this, autoLaunchDeepLink) .setResultCallback( new ResultCallback<AppInviteInvitationResult>() { @Override public void onResult(AppInviteInvitationResult result) { Log.d(TAG, "getInvitation:onResult:" + result.getStatus()); } }); }
  6. protected void onCreate(Bundle savedInstanceState) { boolean autoLaunchDeepLink = true; AppInvite.AppInviteApi.getInvitation(mGoogleApiClient,

    this, autoLaunchDeepLink) .setResultCallback( new ResultCallback<AppInviteInvitationResult>() { @Override public void onResult(AppInviteInvitationResult result) { Log.d(TAG, "getInvitation:onResult:" + result.getStatus()); } }); }
  7. protected void onCreate(Bundle savedInstanceState) { boolean autoLaunchDeepLink = true; AppInvite.AppInviteApi.getInvitation(mGoogleApiClient,

    this, autoLaunchDeepLink) .setResultCallback( new ResultCallback<AppInviteInvitationResult>() { @Override public void onResult(AppInviteInvitationResult result) { Log.d(TAG, "getInvitation:onResult:" + result.getStatus()); } }); }
  8. Tracking ID Create Account Add a Mobile Project to track

    -> Tracking ID Configure Analytics to process App Invites data Create App Invite DashBoard
  9. Application level public static Tracker tracker() { return tracker; }

    @Override public void onCreate() { super.onCreate(); analytics = GoogleAnalytics.getInstance(this); tracker = analytics.newTracker(TRACKING-ID); tracker.enableExceptionReporting(true); tracker.enableAdvertisingIdCollection(true); tracker.enableAutoActivityTracking(true); }
  10. Application level public static Tracker tracker() { return tracker; }

    @Override public void onCreate() { super.onCreate(); analytics = GoogleAnalytics.getInstance(this); tracker = analytics.newTracker(TRACKING-ID); tracker.enableExceptionReporting(true); tracker.enableAdvertisingIdCollection(true); tracker.enableAutoActivityTracking(true); }
  11. Invite sent // Get tracker. Tracker t = ((KitApplication) getApplication()).

    tracker(); // Build and send an Event. t.send(new HitBuilders.EventBuilder() .setCategory(getString(R.string.category_id)) .setAction(getString(R.string.sent)) .build());
  12. Invite sent // Get tracker. Tracker t = ((KitApplication) getApplication()).

    tracker(); // Build and send an Event. t.send(new HitBuilders.EventBuilder() .setCategory(getString(R.string.category_id)) .setAction(getString(R.string.sent)) .build());
  13. Invite received Tracker t = ((MYApplication) getApplication()). tracker(); // Build

    and send an Event. t.send(new HitBuilders.EventBuilder() .setCategory(getString(R.string.category_id)) .setAction(getString(R.string.accepted)) .build());