Android Youtube api v3仅显示开发者Feed

时间:2015-11-16 06:47:02

标签: android youtube-data-api

我正在使用谷歌身份验证开发Android YouTube应用程序,应用程序显示我的开发者帐户供稿,但当我使用不同帐户访问YouTube时,供稿未显示,有什么问题?谷歌开发者控制台中有任何设置吗?

//认证

public void googleLogin() {
        accountManager = AccountManager.get(this);

        authPreferences = new AuthPreferences(this);
        if (authPreferences.getUser() != null
                && authPreferences.getToken() != null) {

            //doCoolAuthenticatedStuff();
        } else {
            chooseAccount();
        }
    }

public void chooseAccount() {
        startActivityForResult(credential.newChooseAccountIntent(),
                REQUEST_ACCOUNT_PICKER);
    }
public class AuthPreferences {

    private static final String KEY_USER = "user";
    private static final String KEY_TOKEN = "token";

    private SharedPreferences preferences;

    public AuthPreferences(Context context) {
        preferences = context
                .getSharedPreferences("auth", Context.MODE_PRIVATE);
    }

    public void setUser(String user) {
        SharedPreferences.Editor editor = preferences.edit();
        editor.putString(KEY_USER, user);
        editor.commit();
    }

    public void setToken(String password) {
        SharedPreferences.Editor editor = preferences.edit();
        editor.putString(KEY_TOKEN, password);
        editor.commit();
    }

    public String getUser() {
        return preferences.getString(KEY_USER, null);
    }

    public String getToken() {
        return preferences.getString(KEY_TOKEN, null);
    }

//获取Feed我使用了示例代码: https://github.com/akoscz/YouTubePlaylist/tree/master/app/src/main/java/com/akoscz/youtube

0 个答案:

没有答案