当前位置: 首页>>代码示例>>Java>>正文


Java AuthenticationRequest类代码示例

本文整理汇总了Java中com.spotify.sdk.android.authentication.AuthenticationRequest的典型用法代码示例。如果您正苦于以下问题:Java AuthenticationRequest类的具体用法?Java AuthenticationRequest怎么用?Java AuthenticationRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AuthenticationRequest类属于com.spotify.sdk.android.authentication包,在下文中一共展示了AuthenticationRequest类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: authenticate

import com.spotify.sdk.android.authentication.AuthenticationRequest; //导入依赖的package包/类
boolean authenticate() {
  //Log.d("DEBUG", "SPOTIFY:: authenticate " + getRedirectUri().toString());

  if (isNetworkEnable && !isAuthenticated && getSavedValue("SPOTIFY_USE", false)) {
    AuthenticationRequest.Builder builder = new Builder(getString(R.string.spotify_client_id),
        Type.TOKEN,
        "jins-meme-bridge-login://callback");
    builder.setShowDialog(false).setScopes(
        new String[]{"user-read-private", "playlist-read", "playlist-read-private",
            "user-follow-read", "user-library-read", "streaming"});
    final AuthenticationRequest request = builder.build();

    AuthenticationClient.openLoginActivity(this, REQUEST_CODE, request);

    return false;
  } else {
    return true;
  }
}
 
开发者ID:tkrworks,项目名称:JinsMemeBRIDGE-Android,代码行数:20,代码来源:MainActivity.java

示例2: onCreate

import com.spotify.sdk.android.authentication.AuthenticationRequest; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_authentication);
    ((Injector) getApplication()).inject(this);
    overridePendingTransition(R.anim.short_fade_in, R.anim.short_fade_out);

    AuthenticationRequest authRequest = new AuthenticationRequest.Builder(
        BuildConfig.SPOTIFY_CLIENT_ID,
        AuthenticationResponse.Type.TOKEN,
        SpotifyConstants.REDIRECT_URI)
        .setScopes(SpotifyConstants.DEFAULT_USER_SCOPES)
        .build();

    AuthenticationClient.openLoginActivity(this,
        ApplicationConstants.LOGIN_INTENT_REQUEST_CODE,
        authRequest);
}
 
开发者ID:ZinoKader,项目名称:SpotiQ,代码行数:19,代码来源:SpotifyAuthenticationActivity.java

示例3: authenticateSpotify

import com.spotify.sdk.android.authentication.AuthenticationRequest; //导入依赖的package包/类
/**
     * Used to get access token to make any calls to the Spotify Api
     * @param callingActivity
     */
    public static void authenticateSpotify (Activity callingActivity){
        AuthenticationRequest.Builder builder = new AuthenticationRequest.Builder(
                callingActivity.getResources().getString(R.string.spotify_client_id),
                AuthenticationResponse.Type.TOKEN,
                callingActivity.getResources().getString(R.string.spotify_redirect_uri)
        );
//        builder.setScopes(new String[]{"streaming"});
        AuthenticationRequest request = builder.build();
        AuthenticationClient.openLoginActivity(
                callingActivity,
                LOGIN_REQUEST_CODE,
                request
        );
    }
 
开发者ID:AkshayPall,项目名称:Songify,代码行数:19,代码来源:SpotifyManager.java

示例4: onCreate

import com.spotify.sdk.android.authentication.AuthenticationRequest; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);

    AuthenticationRequest.Builder builder =
            new AuthenticationRequest.Builder(
                    CLIENT_ID,
                    AuthenticationResponse.Type.TOKEN,
                    REDIRECT_URI);

    builder.setScopes(SpotifyAuthorizationScopes.FULL_ACCESS_SCOPES);
    AuthenticationRequest request = builder.build();

    Log.e("STARTUP", "SPOTIFY TOKEN: " + Utils.getStringFromSharedPreferences(this, R.string.sharedpreferences_global, getString(R.string.spotifyAccessToken_value)));
    Log.e("STARTUP", "SPOTIFY EXPIRY: " + Utils.getSharedPreferences(this, R.string.sharedpreferences_global).getInt(getString(R.string.spotifyAccessToken_expiration), -1));

    Snackbar.make(
            getWindow().getDecorView().getRootView(),
            Utils.checkInternetConnectionString(this),
            Snackbar.LENGTH_LONG
    ).show();

    connectionStateCallback = this;
    AuthenticationClient.openLoginActivity(this, REQUEST_CODE, request);

    buildRecycler();
}
 
开发者ID:sharaquss,项目名称:Betterfy,代码行数:30,代码来源:MainActivity.java

示例5: getAuthenticationRequest

import com.spotify.sdk.android.authentication.AuthenticationRequest; //导入依赖的package包/类
private AuthenticationRequest getAuthenticationRequest(AuthenticationResponse.Type type) {
    return new AuthenticationRequest.Builder(CLIENT_ID, type, getRedirectUri().toString())
            .setShowDialog(false)
            .setScopes(new String[]{"user-read-email"})
            .setCampaign("your-campaign-token")
            .build();
}
 
开发者ID:spotify,项目名称:android-auth,代码行数:8,代码来源:MainActivity.java

示例6: buildRequest

import com.spotify.sdk.android.authentication.AuthenticationRequest; //导入依赖的package包/类
/***
 * Build the REquest according to the configuration given
 *
 * @return
 */
private static AuthenticationRequest buildRequest(final Type type, final String apiCallback, final String[] scopes) {
    AuthenticationResponse.Type spotifyType = (type == Type.CODE) ? AuthenticationResponse.Type.CODE : AuthenticationResponse.Type.TOKEN;

    AuthenticationRequest.Builder builder = new AuthenticationRequest
            .Builder(SpotifyManager.API_KEY, spotifyType, apiCallback).setScopes(scopes);
    return builder.build();
}
 
开发者ID:joxad,项目名称:android-easy-spotify,代码行数:13,代码来源:SpotifyManager.java

示例7: login

import com.spotify.sdk.android.authentication.AuthenticationRequest; //导入依赖的package包/类
private void login(JSONArray scopes, Boolean fetchTokenManually) {
    AuthenticationResponse.Type authType = fetchTokenManually ? AuthenticationResponse.Type.CODE :AuthenticationResponse.Type.TOKEN;


    AuthenticationRequest.Builder builder = new AuthenticationRequest.Builder(clientId,
            authType,
            redirectUri);
    builder.setScopes(new String[]{"user-read-private", "streaming"});
    builder.setShowDialog(true);
    AuthenticationRequest request = builder.build();

    Log.d(TAG, "Client ID " + clientId + "AUTH RESPONSE TYPE " + AuthenticationResponse.Type.TOKEN + "REDIRECT URI " + redirectUri + " Scopes " + scopes + " manual " + fetchTokenManually);

    AuthenticationClient.openLoginActivity(cordova.getActivity(), REQUEST_CODE, request);
}
 
开发者ID:pmwisdom,项目名称:cordova-spotify-plugin,代码行数:16,代码来源:CDVSpotify.java

示例8: openRequest

import com.spotify.sdk.android.authentication.AuthenticationRequest; //导入依赖的package包/类
private void openRequest() {
    AuthenticationRequest.Builder builder = new AuthenticationRequest.Builder(pasta.CLIENT_ID, AuthenticationResponse.Type.TOKEN, REDIRECT_URI);
    builder.setScopes(new String[]{"user-read-private", "user-read-email", "streaming", "user-follow-read", "user-follow-modify", "user-library-read", "playlist-read-private", "playlist-modify-public", "playlist-modify-private"});
    AuthenticationRequest request = builder.build();

    AuthenticationClient.openLoginActivity(this, REQUEST_CODE, request);
}
 
开发者ID:TheAndroidMaster,项目名称:Pasta-for-Spotify,代码行数:8,代码来源:MainActivity.java

示例9: login

import com.spotify.sdk.android.authentication.AuthenticationRequest; //导入依赖的package包/类
private void login() {
    String clientId = getString(R.string.spotify_client_id);
    String[] scopes = getResources().getStringArray(R.array.spotify_scopes);
    String redirectUri = getString(R.string.spotify_callback_uri_scheme)
            + "://" + getString(R.string.spotify_callback_uri_host);

    AuthenticationRequest.Builder builder = new AuthenticationRequest.Builder(clientId,
            AuthenticationResponse.Type.TOKEN,
            redirectUri);
    builder.setScopes(scopes);
    AuthenticationRequest request = builder.build();

    AuthenticationClient.openLoginActivity(this, REQUEST_CODE, request);
}
 
开发者ID:sregg,项目名称:spotify-tv,代码行数:15,代码来源:MainActivity.java

示例10: onRequestCodeClicked

import com.spotify.sdk.android.authentication.AuthenticationRequest; //导入依赖的package包/类
public void onRequestCodeClicked(View view) {
    final AuthenticationRequest request = getAuthenticationRequest(AuthenticationResponse.Type.CODE);
    AuthenticationClient.openLoginActivity(this, AUTH_CODE_REQUEST_CODE, request);
}
 
开发者ID:spotify,项目名称:android-auth,代码行数:5,代码来源:MainActivity.java

示例11: onRequestTokenClicked

import com.spotify.sdk.android.authentication.AuthenticationRequest; //导入依赖的package包/类
public void onRequestTokenClicked(View view) {
    final AuthenticationRequest request = getAuthenticationRequest(AuthenticationResponse.Type.TOKEN);
    AuthenticationClient.openLoginActivity(this, AUTH_TOKEN_REQUEST_CODE, request);
}
 
开发者ID:spotify,项目名称:android-auth,代码行数:5,代码来源:MainActivity.java

示例12: onCreate

import com.spotify.sdk.android.authentication.AuthenticationRequest; //导入依赖的package包/类
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
        ActionBar actionBar = getSupportActionBar();

        actionBar.setTitle(Html.fromHtml("<font color='#111111'>Matchify</font>"));

        setContentView(R.layout.activity_home);


        //Requesting permissions
        if (Build.VERSION.SDK_INT >= 23 && (PackageManager.PERMISSION_GRANTED != checkSelfPermission(Manifest.permission.READ_SMS) ||
                PackageManager.PERMISSION_GRANTED != checkSelfPermission(Manifest.permission.READ_PHONE_STATE))) {
            requestPermissions(INITIAL_PERMS, INITIAL_REQUEST);
        }

        tm = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);


        matchButton = (Button) findViewById(R.id.beginMatching);
//        settingsButton = (Button) findViewById(R.id.settingsButton);

        matchButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (me != null) {
                    Intent matchIntent = new Intent(HomeActivity.this, MatchActivity.class);
                    matchIntent.putExtra("userId", me.id);
                    startActivity(matchIntent);
                } else {
                    Toast.makeText(getApplicationContext(), "Please wait: connecting to Spotify servers...",
                            Toast.LENGTH_SHORT).show();
                }
            }
        });

//        settingsButton.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                Intent playIntent = new Intent(HomeActivity.this, SettingsActivity.class);
//                startActivity(playIntent);
//            }
//        });

        AuthenticationRequest.Builder builder = new AuthenticationRequest.Builder(CLIENT_ID,
                AuthenticationResponse.Type.TOKEN,
                REDIRECT_URI);

        builder.setScopes(new String[]{"user-read-private", "user-read-email", "streaming", "user-top-read"});
        AuthenticationRequest request = builder.build();

        AuthenticationClient.openLoginActivity(this, REQUEST_CODE, request);


    }
 
开发者ID:debkbanerji,项目名称:matchify,代码行数:57,代码来源:HomeActivity.java


注:本文中的com.spotify.sdk.android.authentication.AuthenticationRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。