List of usage examples for android.accounts AuthenticatorException getMessage
public String getMessage()
From source file:org.klnusbaum.udj.network.PlaylistSyncService.java
private void setCurrentSong(Account account, String playerId, String libId, boolean attemptReauth, Intent originalIntent) {/* ww w . j a v a2 s. c o m*/ String authToken = ""; AccountManager am = AccountManager.get(this); try { authToken = am.blockingGetAuthToken(account, "", true); } catch (AuthenticatorException e) { alertSetSongException(account, originalIntent); Log.e(TAG, "Authentication exception when setting song"); } catch (OperationCanceledException e) { alertSetSongException(account, originalIntent); Log.e(TAG, "Op Canceled exception when setting song"); } catch (IOException e) { alertSetSongException(account, originalIntent); Log.e(TAG, "IO exception when geting authtoken for setting song"); Log.e(TAG, e.getMessage()); } try { ServerConnection.setCurrentSong(playerId, libId, authToken); Intent setCurrentComplete = new Intent(Constants.BROADCAST_SET_CURRENT_COMPLETE); this.sendBroadcast(setCurrentComplete); } catch (IOException e) { alertSetSongException(account, originalIntent); Log.e(TAG, "IO exception when setting song"); Log.e(TAG, e.getMessage()); } catch (AuthenticationException e) { if (attemptReauth) { am.invalidateAuthToken(Constants.ACCOUNT_TYPE, authToken); addSongToPlaylist(account, playerId, libId, false, originalIntent); Log.e(TAG, "Soft Authentication exception when setting song"); } else { alertSetSongException(account, originalIntent); Log.e(TAG, "Hard Authentication exception when setting song"); } } catch (PlayerInactiveException e) { Log.e(TAG, "Event over exceptoin when setting song"); Utils.handleInactivePlayer(this, account); } catch (NoLongerInPlayerException e) { Utils.handleNoLongerInPlayer(this, account); } catch (KickedException e) { Utils.handleKickedFromPlayer(this, account); } }
From source file:org.klnusbaum.udj.network.PlaylistSyncService.java
private void addSongToPlaylist(Account account, String playerId, String libId, boolean attemptReauth, Intent originalIntent) {//w ww .j a v a 2s .co m String authToken = ""; AccountManager am = AccountManager.get(this); try { authToken = am.blockingGetAuthToken(account, "", true); } catch (AuthenticatorException e) { alertAddSongException(account, originalIntent); Log.e(TAG, "Authentication exception when adding to playist"); } catch (OperationCanceledException e) { alertAddSongException(account, originalIntent); Log.e(TAG, "Op Canceled exception when adding to playist"); } catch (IOException e) { alertAddSongException(account, originalIntent); Log.e(TAG, "IO exception when geting authtoken for adding to playist"); Log.e(TAG, e.getMessage()); } try { ServerConnection.addSongToActivePlaylist(playerId, libId, authToken); } catch (JSONException e) { alertAddSongException(account, originalIntent); Log.e(TAG, "JSON exception when adding to playist"); } catch (ParseException e) { alertAddSongException(account, originalIntent); Log.e(TAG, "Parse exception when adding to playist"); } catch (IOException e) { alertAddSongException(account, originalIntent); Log.e(TAG, "IO exception when adding to playist"); Log.e(TAG, e.getMessage()); } catch (AuthenticationException e) { if (attemptReauth) { am.invalidateAuthToken(Constants.ACCOUNT_TYPE, authToken); addSongToPlaylist(account, playerId, libId, false, originalIntent); Log.e(TAG, "Soft Authentication exception when adding to playist"); } else { alertAddSongException(account, originalIntent); Log.e(TAG, "Hard Authentication exception when adding to playist"); } } catch (PlayerInactiveException e) { Log.e(TAG, "Event over exceptoin when retreiving playlist"); Utils.handleInactivePlayer(this, account); } catch (NoLongerInPlayerException e) { Utils.handleNoLongerInPlayer(this, account); } catch (KickedException e) { Utils.handleKickedFromPlayer(this, account); } }
From source file:org.klnusbaum.udj.network.PlaylistSyncService.java
private void removeSongFromPlaylist(Account account, String playerId, String libId, boolean attemptReauth, Intent originalIntent) {// w ww . j a va 2 s .co m String authToken = ""; AccountManager am = AccountManager.get(this); try { authToken = am.blockingGetAuthToken(account, "", true); } catch (AuthenticatorException e) { alertRemoveSongException(account, originalIntent); Log.e(TAG, "Authentication exception when removing from playist"); } catch (OperationCanceledException e) { alertRemoveSongException(account, originalIntent); Log.e(TAG, "Op Canceled exception when removing from playist"); } catch (IOException e) { alertRemoveSongException(account, originalIntent); Log.e(TAG, "IO exception when removing from playist/getting authtoken"); Log.e(TAG, e.getMessage()); } try { Log.d(TAG, "Actually removing song"); ServerConnection.removeSongFromActivePlaylist(playerId, libId, authToken); Intent removeSongComplete = new Intent(Constants.BROADCAST_REMOVE_SONG_COMPLETE); this.sendBroadcast(removeSongComplete); } catch (ParseException e) { alertRemoveSongException(account, originalIntent); Log.e(TAG, "Parse exception when removing from playist"); } catch (IOException e) { alertRemoveSongException(account, originalIntent); Log.e(TAG, "IO exception when removing from playist"); Log.e(TAG, e.getMessage()); } catch (AuthenticationException e) { if (attemptReauth) { am.invalidateAuthToken(Constants.ACCOUNT_TYPE, authToken); removeSongFromPlaylist(account, playerId, libId, false, originalIntent); Log.e(TAG, "Soft Authentication exception when removing from playist"); } else { alertRemoveSongException(account, originalIntent); Log.e(TAG, "Hard Authentication exception when removing from playist"); } } catch (PlayerInactiveException e) { Log.e(TAG, "Event over exceptoin when removing from playlist"); Utils.handleInactivePlayer(this, account); } catch (NoLongerInPlayerException e) { Utils.handleNoLongerInPlayer(this, account); } catch (KickedException e) { Utils.handleKickedFromPlayer(this, account); } }