nik*_*min 3 android sync contactscontract android-syncadapter android-contacts
我已经构建了一个联系人同步适配器.这一切都很好,但我还需要一件事.如果由于某种原因导致同步无法成功完成,我希望在同步失败时显示Google帐户显示的消息

解决方案是设置同步结果的延迟.在此延迟之后,将重新启动同步.
try {
DO THE SYNCHRONIZATION
} catch (AuthenticationException e) {
Log.e(TAG, "AuthenticationException");
syncResult.stats.numAuthExceptions++;
syncResult.delayUntil = 180;
} catch (ParseException e) {
Log.e(TAG, "ParseException");
syncResult.stats.numParseExceptions++;
} catch (IOException e) {
Log.e(TAG, "IOException");
syncResult.stats.numIoExceptions++;
syncResult.delayUntil = 180;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1737 次 |
| 最近记录: |