2016-11-24 4 views
0

Facebookのアプリリンクが動作していません。リンクには、次のものが含まれていますFacebookのアプリリンクがAndroidで動作しない

<html> 
    <head> 
    <meta property="al:android:url" content="myapp://12345" /> 
    <meta property="al:android:package" content="com.my.app" /> 
    <meta property="al:android:app_name" content="myApp" /> 
    <meta property="al:web:should_fallback" content="false" /> 
    </head> 
</html> 

Androidmanifestには、次のようなものです:HTMLで

<activity 
android:name="com.my.app.MyAppActivity" 
android:launchMode="singleTask" 
    <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
    </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="myapp" /> 
</intent-filter> 

メタプロパティは、Facebookアプリから意図を起動するための責任を負わなければならないが、Facebookからのリンクを開くと起動しませんアプリケーション。 どこが間違っていますか?

答えて

0

これはApp LinkがFacebookや他の共有の目的で友人と共有するための仕組みです。

シェア意向コード

Intent intent=new Intent(android.content.Intent.ACTION_SEND); 
intent.setType("text/plain"); 
intent.putExtra(Intent.EXTRA_SUBJECT, "Lets Enjoy"); 
intent.putExtra(Intent.EXTRA_TEXT, "Lets Enjoy" + "http://myApp.com/id/"+12345); 
startActivity(Intent.createChooser(intent, "Share With Friends")); 

Androidのマニフェスト。

<activity 
     android:name="com.package.youractivitytoopen" 
     android:theme="@style/MyMaterialTheme" 
     android:screenOrientation="portrait"> 
     <intent-filter> 
      <category android:name="android.intent.category.DEFAULT" /> 
      <action android:name="android.intent.action.VIEW" /> 
      <category android:name="android.intent.category.BROWSABLE" /> 
      <data 
       android:scheme="http" 
       android:host="myApp.com" 
       android:pathPrefix="/id/" ></data> 
     </intent-filter> 
</activity> 

あなたがデータを共有するなら、あなたは、彼らがアプリケーションを持っている場合、それはアプリで開くオプションを表示し、アクティビティであなたを開けます株式の意図を経由してお友達とその

Intent intentShare = getIntent(); 
String action = intentShare.getAction(); 
Uri data = intentShare.getData(); 
if(data!=null) { 
    String url = data.toString(); 
    String[] separated = url.split("/"); 
    id= Integer.parseInt(separated[4]); 
} 

シェアなどのデータを取得しますマニフェストに設定します。

https://developer.android.com/training/app-indexing/deep-linking.html

+0

Facebookにリンクを投稿することができます。しかし、私たちが望むのは、リンクがFacebook上でクリックされると、Androidアプリが開くはずだということです。 –

+0

このコードは、リンクをクリックするとアプリを開きます。 @RakeshAgarwal –

関連する問題