예제 #1
0
  private void openLoginWindow() {
    final AuthenticationRequest request =
        new AuthenticationRequest.Builder(
                CLIENT_ID, AuthenticationResponse.Type.TOKEN, REDIRECT_URI)
            .setScopes(
                new String[] {
                  "user-read-private", "playlist-read", "playlist-read-private", "streaming"
                })
            .build();

    AuthenticationClient.openLoginActivity(this, REQUEST_CODE, request);
  }
예제 #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

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

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

    AuthenticationClient.openLoginActivity(this, REQUEST_CODE, request);

    findViewById(R.id.gotoAlarm)
        .setOnClickListener(
            new View.OnClickListener() {
              public void onClick(View v) {
                gotoAlarm();
              }
            });
  }