Facebook,Android 上的应用链接:未获取意图'data'字段上的架构(应用链接的 Android URL 的 Uri)



我们正在为Android开发Facebook AppLinks。

我们遵循了Facebook开发者页面上的所有指令:

https://developers.facebook.com/docs/applinks/add-to-contenthttps://developers.facebook.com/docs/applinks/android

  1. 在我们的网页(目标url)中,我们定义了元:
  <meta property="al:android:url" content="mySchema://?id=3643020" />
  <meta property="al:android:app_name" content="myAppName" />
  <meta property="al:android:package" content="com.my.package" />
  <meta property="al:android:class" content="com.my.package.screens.BrowseableActivity"/>

标签内。

对于Schema,我们也尝试了这个:

  <meta property="al:android:url" content="mySchema://id=3643020" />
    (without the ? character)
  1. 在我们的Android应用程序中,在BrowsebleActivity的清单中,我们定义:

    <activity android:name=".screens.BrowseableActivity" 
        android:theme="@style/Theme.myAppName.myTheme" >    
         <intent-filter>
            <action android:name="com.my.package.screens.BrowseableActivity" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter> 
        <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:scheme="mySchema"/>
        </intent-filter>      
    </activity> 
    

当我们测试时:

  1. 我们从应用程序中共享到Facebook的链接,其中"链接"属性是包含元的"目标url"。没关系。

  2. 在Facebook Android应用程序(版本18.0.0.24.14)中,我们看到了上一步中分享的帖子。

  3. 我们点击帖子,我们的应用程序就打开了!在这里之前一切都很好。

我们的问题:

根据打开我们的"浏览活动"的意向书中的Facebook文档,"数据"字段应具有以下信息:

data: "mySchema://id=3643020?target_url=http%3A%2F%2Fwww.ourtargeturl.com%2Fdirectory"
this is: the Schema (Uri or Android Url) and the Target_url

但对我们来说,我们只有这个:

data: "http%3A%2F%2Fwww.ourtargeturl.com%2Fdirectory"
We only got the target_url.

在Facebook的这个页面(https://developers.facebook.com/docs/applinks/android)他们说如果你没有收到"架构",如果因为你没有在target_url。但是,我们定义它。

此外,在Intent的其他字段中(额外的x示例),我们没有看到"架构"信息。

这些信息正是我们所需要的,我们不知道还能尝试什么。

谢谢,

不要指定类名。如果您指定类名,它将使用包名/类名组合来创建具有componentName的意图,该意图直接针对您的应用程序/活动。在这一点上,"数据"字段中的内容实际上是未定义的。

如果您跳过指定al:android:class属性,那么它将使用您的自定义url。

最新更新