- notification.setLatestEventInfo(getContext().getApplicationContext(), \r
- getContext().getString(R.string.sync_fail_ticker), \r
- String.format(getContext().getString(R.string.sync_fail_content), getAccount().name), \r
- notification.contentIntent);\r
+ if (needsToUpdateCredentials) {\r
+ // let the user update credentials with one click\r
+ Intent updateAccountCredentials = new Intent(getContext(), AuthenticatorActivity.class);\r
+ updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACCOUNT, getAccount());\r
+ updateAccountCredentials.putExtra(AuthenticatorActivity.EXTRA_ACTION, AuthenticatorActivity.ACTION_UPDATE_TOKEN);\r
+ updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);\r
+ updateAccountCredentials.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);\r
+ updateAccountCredentials.addFlags(Intent.FLAG_FROM_BACKGROUND);\r
+ notification.contentIntent = PendingIntent.getActivity(getContext(), (int)System.currentTimeMillis(), updateAccountCredentials, PendingIntent.FLAG_ONE_SHOT);\r
+ notification.setLatestEventInfo(getContext().getApplicationContext(), \r
+ getContext().getString(R.string.sync_fail_ticker), \r
+ String.format(getContext().getString(R.string.sync_fail_content_unauthorized), getAccount().name), \r
+ notification.contentIntent);\r
+ Log.e(TAG, "NEEDS TO UPDATE CREDENTIALS");\r
+ } else {\r
+ notification.setLatestEventInfo(getContext().getApplicationContext(), \r
+ getContext().getString(R.string.sync_fail_ticker), \r
+ String.format(getContext().getString(R.string.sync_fail_content), getAccount().name), \r
+ notification.contentIntent);\r
+ }\r