本文整理汇总了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;
}
}
示例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);
}
示例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
);
}
示例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();
}
示例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();
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}