Android Share - Facebook SDK - ShareActionProvider [英] Android Share - Facebook SDK - ShareActionProvider

查看:170
本文介绍了Android Share - Facebook SDK - ShareActionProvider的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的应用程序中实现共享一个简单的字符串。显然除了Facebook之外的一切都有用。据我所知,现在我必须使用他们的Facebook SDK在墙上发布状态。



但是,如果我使用他们的SDK实现它,是否有方法是将其合并到选择器(默认或ShareActionProvider)中,并以某种方式覆盖它并插入Facebook SDK的实现?



或者我必须创建一个专用按钮? / p>

//编辑

  package com.example.shareactionproviderdemo; 

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

public class MainActivity extends Activity {

@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

Intent sharingIntent = new Intent(Intent.ACTION_SEND);
sharingIntent.setType(text / plain);
sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT,测试消息);
startActivity(Intent.createChooser(sharingIntent,分享使用));
}

}

解决方案

答案你不能通过使用意图来共享一个字符串到用户自己的墙。您需要SDK才能做到这一点。原因是因为Facebook不允许预先填写用户状态更新,如平台中所示政策IV.2 。但是,如果您使用SDK,我们提供了一个Feed对话框,提示用户共享状态,并允许部分状态更新由开发商。然而,它并未纳入Android的本机选择器。



跟踪此问题的外部错误报告是 here


I am trying to implement sharing a simple string inside my application. Obviously everything other than Facebook works. As far as I know, now I have to use their Facebook SDK to post statuses on a wall.

However, if I do implement it using their SDK, is there a way to have it incorporated into the chooser (default or ShareActionProvider) and somehow override it and insert the Facebook SDK's implementation?

Or do I have to create a dedicated button?

//EDIT

package com.example.shareactionproviderdemo;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

public class MainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Intent sharingIntent = new Intent(Intent.ACTION_SEND);
        sharingIntent.setType("text/plain");
        sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Test message");
        startActivity(Intent.createChooser(sharingIntent, "Share using"));
    }

}

解决方案

The answer is you cannot share a string to the user's own wall by using intents. You need the SDK in order to do that. The reason why is because Facebook does not allow the prefilling of the user's status update as seen in Platform Policy IV.2.

However, if you use the SDK, we have provided a feed dialog that prompts the user to share a status and it allows parts of the status update to be prefilled by the developer. It is not incorporated into the Android's native chooser, however.

The external bug report that tracked this issue is here.

这篇关于Android Share - Facebook SDK - ShareActionProvider的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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