Firebase Dynamic Links

Firebase Dynamic Links

0ef9d512061aa068aafd47c3e3f13ce0?s=128

Yuki Shiho

July 08, 2016
Tweet

Transcript

  1. 3.
  2. 9.

    %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
  3. 10.

    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
  4. 11.

    %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
  5. 13.

    -JOL/BNF  -JOL63-  "OESPJE"QQ  QBDLBHFOBNF  $VTUPN4DIFNFɿ-JOL63-ΑΓ΋༏ઌ͞ΕΔ 'BMMCBDLMJOLɿΞϓϦະΠϯετʔϧ࣌ͷભҠઌʢσ

    ϑΥϧτͰ͸ετΞʹભҠʣ .JOJNVNWFSTJPODPEF $VTUPNBQQMPDBUJPO %ZOBNJD-JOLTPO"OESPJEʢʣ
  6. 14.

    %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]
  7. 15.

    EPNBJO  MJOL  BQO  QBDLBHFOBNF   BMɿ$VTUPN4DIFNF

    Bqɿ'BMMCBDLMJOL BNWɿ.JOJNVNWFSTJPODPEF VUN@TPVSDF VUN@NFEJVN VUN@DBNQBJHO  VUN@UFSN VUN@DPOUFOU HDMJE %ZOBNJD-JOLTPO"OESPJEʢʣ
  8. 16.

    %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
  9. 17.

    %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
  10. 18.

    %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ɹ
  11. 22.
  12. 27.