I'm using the Android SDK Authentication Library for Apple Music, Up until about two days ago it worked fine and I managed to retrieve a Music User Token, However I accidentally deleted the Apple Music App and upon re-installation whenever I try to authenticate the app returns with an error: USER_CANCELLED even though I didn't cancel and I successfully logged in.
Authentication Code:
private void authenticateApple(String token){
Intent intent = authenticationManager.createIntentBuilder(token)
.setHideStartScreen(true)
.setStartScreenMessage("Sign In")
.build();
startActivityForResult(intent, REQUEST_CODE_APPLE_MUSIC_AUTH);
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_CODE_APPLE_MUSIC_AUTH) {
TokenResult result = authenticationManager.handleTokenResult(data);
if (result.isError()) {
TokenError error = result.getError();
Log.e("ERROR", "error:" + error.toString());
}
else {
editor.putString("music_user_token", result.getMusicUserToken());
editor.apply();
read_playlists();
}
}
else {
super.onActivityResult(requestCode, resultCode, data);
}
}
LogCat:
2020-03-25 18:54:51.614 31849-31849/com.example.switcheroo D/APPLE MUSIC: STARTING FLOW
2020-03-25 18:54:51.626 31849-31849/com.example.switcheroo D/ViewRootImpl@bae0ea3[HomeAct]: MSG_WINDOW_FOCUS_CHANGED 0
2020-03-25 18:54:51.658 31849-31854/com.example.switcheroo I/zygote64: Do partial code cache collection, code=27KB, data=26KB
2020-03-25 18:54:51.658 31849-31854/com.example.switcheroo I/zygote64: After code cache collection, code=27KB, data=26KB
2020-03-25 18:54:51.658 31849-31854/com.example.switcheroo I/zygote64: Increasing code cache capacity to 128KB
2020-03-25 18:54:51.725 31849-31849/com.example.switcheroo D/SDKUriHandlerActivity: onCreate: eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXV etc...(dev token)
2020-03-25 18:54:51.726 31849-31849/com.example.switcheroo D/AuthUtils: deeplinkAppleMusic: uri = musicsdk://applemusic/authenticate-v1?appPackage=com.example.switcheroo&devToken=eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IlQyOEpCN0pQRk0ifQ.eyJpYXQiO etc...(dev token)
2020-03-25 18:54:51.727 31849-31849/com.example.switcheroo D/a: deeplinkAppleMusic: isAppleMusicInstalled(activity) = 0
2020-03-25 18:54:51.816 31849-31877/com.example.switcheroo D/OpenGLRenderer: eglDestroySurface = 0x73dc452870
2020-03-25 18:54:51.816 31849-31877/com.example.switcheroo D/OpenGLRenderer: endAllActiveAnimators on 0x73db471c00 (RippleDrawable) with handle 0x73e62ac840
2020-03-25 18:54:51.832 31849-31849/com.example.switcheroo D/ViewRootImpl@bae0ea3[HomeAct]: Relayout returned: old=[0,0][1440,2560] new=[0,0][1440,2560] result=0x5 surface={valid=false 0} changed=true
2020-03-25 18:54:52.697 31849-31849/com.example.switcheroo D/ViewRootImpl@bae0ea3[HomeAct]: Relayout returned: old=[0,0][1440,2560] new=[0,0][1440,2560] result=0x1 surface={valid=false 0} changed=false
2020-03-25 18:55:09.413 31849-31849/com.example.switcheroo D/SDKUriHandlerActivity: onActivityResult: 2022, data = Intent { (has extras) }
2020-03-25 18:55:09.450 31849-31849/com.example.switcheroo E/ERROR: error:USER_CANCELLED
2020-03-25 18:55:09.466 31849-31849/com.example.switcheroo D/ViewRootImpl@68035bf[AppleReadAct]: setView = DecorView@fa507d5[AppleReadAct] TM=true MM=false
2020-03-25 18:55:09.475 31849-31849/com.example.switcheroo D/ViewRootImpl@68035bf[AppleReadAct]: dispatchAttachedToWindow
2020-03-25 18:55:09.494 31849-31849/com.example.switcheroo V/Surface: sf_framedrop debug : 0x4f4c, game : false, logging : 0
2020-03-25 18:55:09.495 31849-31849/com.example.switcheroo D/ViewRootImpl@68035bf[AppleReadAct]: Relayout returned: old=[0,0][0,0] new=[0,0][1440,2560] result=0x7 surface={valid=true 497784123392} changed=true
I tried restarting my phone but the problem persists, Any ideas? (I'm running the app on a Galaxy s7 edge)
EDIT: I also tried this on an s9 and got the same results...
Hi barbecu,
Noticed you posted over in this other thread. There was an update to Apple Music on Android last week that might help, but if not, it looks like a few others posted there as well and with all the feedback there, might be route to a resolution in that topic.