mirror of
https://github.com/nerzhul/ownCloud-SMS-App.git
synced 2025-06-26 01:06:34 +00:00
Background sync: cancel notifications at the right moment
This commit is contained in:
parent
c01df1b64a
commit
533c7ae3c0
@ -63,12 +63,13 @@ public class SmsSyncAdapter extends AbstractThreadedSyncAdapter {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// getServerAPI version
|
// getServerAPI version
|
||||||
Log.d(TAG,"Server API version: " + _client.getServerAPIVersion());
|
Log.d(TAG, "Server API version: " + _client.getServerAPIVersion());
|
||||||
|
|
||||||
// and push datas
|
// and push datas
|
||||||
_client.doPushRequest(null);
|
_client.doPushRequest(null);
|
||||||
OCSMSNotificationUI.cancel(getContext());
|
OCSMSNotificationUI.cancel(getContext());
|
||||||
} catch (final OCSyncException e) {
|
} catch (final OCSyncException e) {
|
||||||
|
OCSMSNotificationUI.cancel(getContext());
|
||||||
OCSMSNotificationUI.notify(getContext(), getContext().getString(R.string.fatal_error),
|
OCSMSNotificationUI.notify(getContext(), getContext().getString(R.string.fatal_error),
|
||||||
getContext().getString(e.getErrorId()), OCSMSNotificationType.SYNC_FAILED.ordinal());
|
getContext().getString(e.getErrorId()), OCSMSNotificationType.SYNC_FAILED.ordinal());
|
||||||
if (e.getErrorType() == OCSyncErrorType.IO) {
|
if (e.getErrorType() == OCSyncErrorType.IO) {
|
||||||
@ -84,8 +85,6 @@ public class SmsSyncAdapter extends AbstractThreadedSyncAdapter {
|
|||||||
// UNHANDLED
|
// UNHANDLED
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OCSMSNotificationUI.cancel(getContext());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final AccountManager _accountMgr;
|
private final AccountManager _accountMgr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user