I'm having great difficulty getting AppLinks working for my Android app, I will call MyApp. I have followed the documentation on the Facebook Developers site for integrating App Links into existing content. The Facebook Debug tool (https://developers.facebook.com/tools/debug/og/object/) shows my webpage getting scraped correctly, and shows my 3 meta tags for applinks:
<meta property="al:android:app_name" content="MyApp" />
<meta property="al:android:package" content="com.myapp.android" />
<meta property="al:android:url" content="myapp://myapphost/myapppath" />
I have Open Graph Stories that I post to Facebook using the Share Dialog, which share the URL I have just put through the Facebook Debug Tool. These Open Graph Stories have been reviewed/approved by Facebook, and show in the news feeds. When clicked on, in Facebook in a browser, they go to the URL associated with the Story. When clicked on, in Facebook for Android, they only open MyApp's default Activity (MainActivity), rather than the Activity that handles the URI scheme (UriLoadingActivity). I know the URI scheme works, because I use it in push notifications: when a user clicks on the notification, it takes them to the UriLoadingActivity:
<activity
android:name="com.myapp.android.activity.UriLoadingActivity"
android:parentActivityName="com.myapp.android.activity.MainActivity" >
<intent-filter>
<action android:name="android.intent.action.GET_CONTENT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<data
android:host="myapphost"
android:scheme="myapp" />
</intent-filter>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.myapp.android.activity.MainActivity" />
</activity>
I have Logs in onCreate() of MainActivity to check the Intent data passed from Facebook. As such, I see the Facebook package and app name in the referer_app_link Bundle. I also get the target_url which has the webpage URL I posted in my Open Graph Story, however, I do not see any of the AppLink data I have provided in the Meta tags on my webpage.
Is anyone else experiencing similar issues?
Update: here is the code I use to post to FB.
private void shareToFacebook(Bitmap image) {
if (FacebookDialog.canPresentOpenGraphActionDialog(
getApplicationContext(),
FacebookDialog.OpenGraphActionDialogFeature.OG_ACTION_DIALOG)) {
OpenGraphObject myObject = OpenGraphObject.Factory
.createForPost("myapp:object");
myObject.setProperty("title", "My Title");
myObject.setUrl(Constants.SHARE_URL);
myObject.setProperty("description",
"Just Posting to the News Feed!");
OpenGraphAction action = GraphObject.Factory
.create(OpenGraphAction.class);
action.setType("myapp:action");
action.setProperty("object", myObject);
List<Bitmap> images = new ArrayList<Bitmap>();
images.add(image);
FacebookDialog shareDialog = new FacebookDialog.OpenGraphActionDialogBuilder(
this, action, "object").setImageAttachmentsForObject(
"object", images, false).build();
uiHelper.trackPendingDialogCall(shareDialog.present());
}
}