获取阅读和发布权限的一个请求 [英] Get Read and Publish Permissions in one request

查看:219
本文介绍了获取阅读和发布权限的一个请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在大家说这是不可能的,打开Spotify的应用程序,并按下与Facebook按钮的登入。

我不知道他们是怎么做的,我怎么能得到publish_stream和基本权限/电子邮件的一个请求。

此外,是否有可能对我来说,使用Facebook SDK重新打开一个Facebook会话,如果我从上届会议的某些信息(他们使用的应用程序最后一次)?

修改 -SCREENSHOTS以下是这些音乐AVERT

解决方案

你什么都看到了Spotify的不是 publish_stream 的结局。什么他们使用的是< A HREF =htt​​p://developers.facebook.com/docs/concepts/opengraph/>

打开图概念涉及整合的应用程序的行为与FB活动发布,并通过他们使用的应用程序的用户共享。了解更多关于它在上面提到的链接。


编辑 说明检查的Open Graph权限

样品活动:

 公共类MainActivity扩展活动实现StatusCallback {

    @覆盖
    保护无效的onCreate(包savedInstanceState){
        super.onCreate(savedInstanceState);
        的setContentView(R.layout.activity_main);
        OpenRequest打开=新OpenRequest(本);
        open.setLoginBehavior(SessionLoginBehavior.SUP preSS_SSO);
        open.setPermissions(Arrays.asList(新的String [] {电子邮件,publish_actions,user_birthday,user_hometown}));
        open.setCallback(本);
        会议S =新的Session(本);
        s.openForPublish(开);
    }

    @覆盖
    公共无效呼叫(会话的会话,SessionState会状态,例外的例外){
    }

    @覆盖
    保护无效onActivityResult(INT申请code,INT结果code,意图数据){
        super.onActivityResult(要求code,因此code,数据);
        如果(Session.getActiveSession()!= NULL)
            Session.getActiveSession()onActivityResult(这一点,要求code,因此code,数据)。
    }
}
 

此活动将显示此(如果没有登录的用户):

Before you all say it's not possible, open up the Spotify app and hit the signin with Facebook button.

I'm wondering how they did it, and how I can get "publish_stream" and basic permissions/email in one request.

Also, is it possible for me to reopen a Facebook session using the Facebook SDK if I have certain info from the last session (last time they used the app)?

EDIT -SCREENSHOTS BELOW FOR THE MUSICALLY AVERT

解决方案

What ever you saw on Spotify is not the outcome of publish_stream .What they have used is the Open Graph

Open graph concepts involves integrating actions of the app with the FB activity post and share with the users through the application they use. Read more about it at the above mentioned link.


Edits Explanation: Check the Open Graph Permissions

Sample Activity:

public class MainActivity extends Activity implements StatusCallback {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        OpenRequest open = new OpenRequest(this);
        open.setLoginBehavior(SessionLoginBehavior.SUPPRESS_SSO);
        open.setPermissions(Arrays.asList(new String[]{"email", "publish_actions", "user_birthday", "user_hometown"}));
        open.setCallback(this);
        Session s = new Session(this);
        s.openForPublish(open);
    }

    @Override
    public void call(Session session, SessionState state, Exception exception) {
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if(Session.getActiveSession()!=null)
            Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data);
    }
}

This activity will show this (if the user is not logged in):

这篇关于获取阅读和发布权限的一个请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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