URL打开在android的Facebook应用程序 [英] URL to open facebook app in android

查看:228
本文介绍了URL打开在android的Facebook应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:
  从Android应用程序打开的Facebook页面?

我在我的Andr​​oid应用程序一个web视图,我想提出一个链接,在打开的Facebook应用程序,以我的fanpage。在iOS系统中,你可以说FB:// ...,它就会打开Facebook的应用程序。有没有办法做到这一点在Android的?我已经重写shouldOverrideUrlLoading,所以如果我需要,我可以拦截并启动意图。

I have a webview in my android app, and I would like to put a link in that opens the facebook app to my fanpage. In iOS you can say fb://... and it will open the facebook app. Is there a way to do it in android? I'm already overriding shouldOverrideUrlLoading, so I could intercept it and launch an intent if I need to.

推荐答案

您需要使用意图。以下是如何调用FB应用程序(如果已安装):

You need to use Intents. Here's how to call the FB application (if it is installed):

Intent intent = new Intent();
intent.setClassName("com.facebook.katana","com.facebook.katana.ProxyAuth");
intent.putExtra("client_id", applicationId);
mAuthActivityCode = activityCode;
activity.startActivityForResult(intent, activityCode);

这code是从Facebook的API,其授权的行动。 Ajust,以满足您的需求。 code是版权所有2010 Facebook的公司,在Apache许可证授权,版本2.0。

This code is taken from the Facebook API, which authorizes an action. Ajust to suit your needs. Code is Copyright 2010 Facebook, Inc., licensed under the Apache License, Version 2.0.

这篇关于URL打开在android的Facebook应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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