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

Firebase Dynamic Links

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.

Firebase Dynamic Links

Avatar for Yuki Shiho

Yuki Shiho

July 08, 2016
Tweet

More Decks by Yuki Shiho

Other Decks in Programming

Transcript

  1. %ZOBNJD-JOLTPO"OESPJEʢʣ 1. Add Firebase to your Android Project. buildscript {

    // ... dependencies { // ... classpath 'com.google.gms:google-services:3.0.0' } } root-level build.gradle file
  2. apply plugin: 'com.android.application' dependencies { // ... compile ‘com.google.firebase:firebase-core:9.2.0' compile

    'com.google.firebase:firebase-invites:9.2.0' } // ADD THIS AT THE BOTTOM apply plugin: 'com.google.gms.google-services' %ZOBNJD-JOLTPO"OESPJEʢʣ app/build.gradle file
  3. %ZOBNJD-JOLTPO"OESPJEʢʣ 2. In the Firebase console, open the 
 Dynamic

    Links section. Take note of 
 your project's Dynamic Links domain. domain looks like app_code.app.goo.gl
  4. -JOL/BNF  -JOL63-  "OESPJE"QQ  QBDLBHFOBNF  $VTUPN4DIFNFɿ-JOL63-ΑΓ΋༏ઌ͞ΕΔ 'BMMCBDLMJOLɿΞϓϦະΠϯετʔϧ࣌ͷભҠઌʢσ

    ϑΥϧτͰ͸ετΞʹભҠʣ .JOJNVNWFSTJPODPEF $VTUPNBQQMPDBUJPO %ZOBNJD-JOLTPO"OESPJEʢʣ
  5. %ZOBNJD-JOLTPO"OESPJEʢʣ 4. Create a Dynamic Link Create a Dynamic Link

    programmatically https://domain/?link=your_deep_link&apn=package_name
 [&amv=minimum_version][&ad=1][&al=android_link][&afl=fallback_link]
  6. EPNBJO  MJOL  BQO  QBDLBHFOBNF   BMɿ$VTUPN4DIFNF

    Bqɿ'BMMCBDLMJOL BNWɿ.JOJNVNWFSTJPODPEF VUN@TPVSDF VUN@NFEJVN VUN@DBNQBJHO  VUN@UFSN VUN@DPOUFOU HDMJE %ZOBNJD-JOLTPO"OESPJEʢʣ
  7. %ZOBNJD-JOLTPO"OESPJEʢʣ 5. Open Dynamic Links in your app you must

    add an intent filter to the activity 
 that handles deep links for your app <intent-filter> <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.BROWSABLE"/> <data android:host="example.com" android:scheme="http"/> <data android:host="example.com" android:scheme="https"/> </intent-filter> AndroidManifest.xml
  8. %ZOBNJD-JOLTPO"OESPJEʢʣ 6. Handle deep links @Override protected void onCreate(Bundle savedInstanceState)

    { // ... // Build GoogleApiClient with AppInvite API for receiving deep links mGoogleApiClient = new GoogleApiClient.Builder(this) .enableAutoManage(this, this) .addApi(AppInvite.API) .build(); ***Activity.java
  9. %ZOBNJD-JOLTPO"OESPJEʢʣ AppInvite.AppInviteApi.getInvitation(mGoogleApiClient, this, false) .setResultCallback( new ResultCallback<AppInviteInvitationResult>() { @Override public

    void onResult(@NonNull AppInviteInvitationResult result) { if (result.getStatus().isSuccess()) { // Extract deep link from Intent Intent intent = result.getInvitationIntent(); String deepLink = AppInviteReferral.getDeepLink(intent); // Handle the deep link. For example, open the linked content } else { // no deep link found. } } }); } ***Activity.javaɹ