Blank Login Screen using AuthenticationClient
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Plan
Premium
Country
USA
Device
Pixel 3a Virtual Device (API 28)
Operating System
Android 9.0 Pie
My Question or Issue
I'm using the AuthenticationRequest and AuthenticationClient to connect a Spotify account to my app. After testing a few times with installing the app, logging in through the Login Activity, deleting the app, and repeating, the log in screen started turning out blank. No matter what I do, now, I can't get the login screen back.
I've tried using different devises, wiping the device and reinstalling, restarting my IDE, and using different OS versions.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
Objects.requireNonNull(getSupportActionBar()).hide();
setContentView(R.layout.activity_splash);
authenticateSpotify();
sharedPreferences = this.getSharedPreferences("SPOTIFY", 0);
queue = Volley.newRequestQueue(this);
}
private void authenticateSpotify() {
AuthenticationRequest.Builder builder = new AuthenticationRequest.Builder(CLIENT_ID, AuthenticationResponse.Type.TOKEN, REDIRECT_URI);
builder.setScopes(new String[]{SCOPES});
AuthenticationRequest request = builder.build();
AuthenticationClient.openLoginActivity(this, REQUEST_CODE, request);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
super.onActivityResult(requestCode, resultCode, intent);
if (requestCode == REQUEST_CODE) {
AuthenticationResponse response = AuthenticationClient.getResponse(resultCode, intent);
switch (response.getType()) {
case TOKEN:
editor = getSharedPreferences("SPOTIFY", 0).edit();
editor.putString("token", response.getAccessToken());
editor.apply();
waitForUserInfo();
break;
case ERROR:
default:
break;
}
}
}
private void waitForUserInfo() {
UserService userService = new UserService(queue, sharedPreferences);
userService.getUserInfo(() -> {
User user = userService.getUser();
editor = getSharedPreferences("SPOTIFY", 0).edit();
editor.putString("userid", user.id);
editor.putString("email", user.email);
editor.putString("name", user.display_name);
editor.commit();
startMainActivity();
});
}
private void startMainActivity() {
Intent newIntent = new Intent(AuthenticateSpotify.this, MainActivity.class);
startActivity(newIntent);
}
Labels:
- Labels:
-
AuthenticationClient
-
bug
-
Login Activity

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page