如何使用自己的Android应用程序中的意图在Facebook应用程序中打开特定相册或照片 [英] How to open a specific album or photo in facebook app using intent from your own Android App

查看:69
本文介绍了如何使用自己的Android应用程序中的意图在Facebook应用程序中打开特定相册或照片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用自己的Android应用程序中的意图在facebook应用程序中打开相册或照片?

How to open an album or photo in facebook app using intent from your own Android App?

我一直在寻找这个的具体答案.大多数问题是关于如何通过意图打开Facebook页面的.

I been searching for the specific answer for this one. Most question are about how to open a facebook page via intent.

我看到了这个(关于iAppStreet的一名高级软件工程师Sunny),但是它不起作用.

I saw this one (regards to Sunny a Sr. Software engineer at iAppStreet) but it doesn't work.

public Intent getOpenFacebookIntent(String pId) {

try {
    activity.getPackageManager().getPackageInfo("com.facebook.katana", 0);
    return new Intent(Intent.ACTION_VIEW, Uri.parse("facebook:/photos?album=0&photo=" + pId+"&user="+ownerId));
} catch (Exception e) {
    return new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/"));
}
}

startActivity(getOpenFacebookIntent(pid));

谢谢.

推荐答案

特别是,新版本的Facebook应用程序可与

In particular, new versions of facebook app work with

Uri.parse("fb://facewebmodal/f?href=" + FACEBOOKURL

我发现这是实现所需功能的最简单方法.

I found this the simplest approach to acheive what was needed.

还请注意,要获取URL,可以转到Facebook相册(在Facebook桌面上),单击编辑"和标签"旁边的三个点,然后选择获取链接".我发现这比简单地从浏览器复制URL更为可靠.

Note also that to get the URL you can go to the facebook album (on facebook desktop), click the three dots next to "Edit" and "Tag" and select "Get Link". I found this more reliable than simply copying the URL from the browser.

这篇关于如何使用自己的Android应用程序中的意图在Facebook应用程序中打开特定相册或照片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆