2017-08-27 57 views
7

AndroidManifest如何接收Facebook的深層鏈接數據

<activity android:name=".MainActivity"> 
    <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="linhtestdeeplink" 
      android:scheme="app"/> 
    </intent-filter> 
</activity> 

MainActivity

AppLinkData.fetchDeferredAppLinkData(this, 
     new AppLinkData.CompletionHandler() { 
      @Override 
      public void onDeferredAppLinkDataFetched(final AppLinkData appLinkData) { 
       // Process app link data 
       Log.i("TAG", "Deep link receive" + appLinkData); 
      } 
     } 
); 

Facebook頁面,我測試深層鏈接就像

enter image description here

我的應用程序我收到通知時,我會在通知它會啓動我的應用程序,但appLinkData總是null
我也發送像linhtestdeeplink://tripId=1但它也爲空。
任何幫助或建議將不勝感激。
我使用Facebook的SDK 4.5 compile 'com.facebook.android:facebook-android-sdk:[4,5)'

+0

是否有可能發佈完整的代碼/鏈接? –

回答

2

深層鏈接的格式<scheme>://<host>所以你的深層鏈接應該是這樣的: app://linhtestdeeplink?tripId=1