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

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

问题描述

在你们都说不可能之前,打开Spotify应用程序并用Facebook按钮打开登录。



我想知道他们是如何做到的我可以在一个请求中获得publish_stream和基本权限/电子邮件。



另外,如果我有一定的话,我可以使用Facebook SDK重新打开一个Facebook会话



编辑下面的音乐下载 -



解决方案

您在Spotify中看到的内容不是 publish_stream 的结果。他们使用的是打开图表



开放式图形概念涉及将该应用程序与FB活动发布,并通过他们使用的应用程序与用户共享。在上述链接中了解更多信息。






编辑 说明
检查打开图表权限



示例活动:

  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);
}
}

此活动将显示(如果用户不登录):




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天全站免登陆