从Android的图片分享至Facebook?图片、Android、Facebook

2023-09-04 07:31:26 作者:花心男

我怎么可以从我的应用程序的Facebook在Android中共享一个形象?

解决方案

 公共无效shareOnFacebook(){
    开放的我们的uri = Uri.parse(http://m.facebook.com/sharer.php?u=+
            website_url +& T公司=+ someTitle.replaceAll(,+);
    意向意图=新的意图(Intent.ACTION_VIEW,URI);
    startActivity(意向);
}
 

在您的网站应持有meta标签如

 <链接相对=image_src类型=图像/ JPEG的href =htt​​p://www.domain.com/someimage.jpg/>
 

这将被用来在Facebook的形象宣传片。当然这也可以动态地对服务器侧进行。

Fresco图片框架内部实现原理探索

这是在您使用一个形象,也是一台服务器上的某个地方已的办法,这样你就不会需要从你的Andr​​oid设备首先发送到服务器。根据你的使用情况,但是这通常是最简单的方法。

How i can share a image from from my app to facebook in android?

解决方案

public void shareOnFacebook() {
    Uri uri = Uri.parse("http://m.facebook.com/sharer.php?u=" +
            website_url + "&t="+ someTitle.replaceAll(" ","+");
    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
    startActivity(intent);
}

where your website should hold a meta tag like

<link rel="image_src" type="image/jpeg" href="http://www.domain.com/someimage.jpg" />

which will then be used on Facebook as the promo image. Of course this can also be done dynamically on server side.

This is the approach where you use an image that's also on a server somewhere already, so you don't need to send it from your Android device to a server first. Depending on your use case, but this is usually the easiest way.