1
0
mirror of https://github.com/nerzhul/ownCloud-SMS-App.git synced 2025-06-25 16:56:23 +00:00

Background sync: cancel notifications at the right moment

This commit is contained in:
Loic Blot 2016-03-10 10:53:21 +01:00
parent c01df1b64a
commit 533c7ae3c0

View File

@ -63,12 +63,13 @@ public class SmsSyncAdapter extends AbstractThreadedSyncAdapter {
try {
// getServerAPI version
Log.d(TAG,"Server API version: " + _client.getServerAPIVersion());
Log.d(TAG, "Server API version: " + _client.getServerAPIVersion());
// and push datas
_client.doPushRequest(null);
OCSMSNotificationUI.cancel(getContext());
} catch (final OCSyncException e) {
OCSMSNotificationUI.cancel(getContext());
OCSMSNotificationUI.notify(getContext(), getContext().getString(R.string.fatal_error),
getContext().getString(e.getErrorId()), OCSMSNotificationType.SYNC_FAILED.ordinal());
if (e.getErrorType() == OCSyncErrorType.IO) {
@ -84,8 +85,6 @@ public class SmsSyncAdapter extends AbstractThreadedSyncAdapter {
// UNHANDLED
}
}
OCSMSNotificationUI.cancel(getContext());
}
private final AccountManager _accountMgr;