use of com.zegoggles.smssync.service.exception.SmsProviderNotWritableException in project sms-backup-plus by jberkel.
the class SmsRestoreService method handleIntent.
@Override
protected void handleIntent(final Intent intent) {
if (isWorking())
return;
try {
final boolean restoreCallLog = getPreferences().getDataTypePreferences().isRestoreEnabled(CALLLOG);
final boolean restoreSms = getPreferences().getDataTypePreferences().isRestoreEnabled(SMS);
if (restoreSms && !canWriteToSmsProvider()) {
postError(new SmsProviderNotWritableException());
return;
}
MessageConverter converter = new MessageConverter(service, getPreferences(), getAuthPreferences().getUserEmail(), new PersonLookup(getContentResolver()), new ContactAccessor());
RestoreConfig config = new RestoreConfig(getBackupImapStore(), 0, restoreSms, restoreCallLog, getPreferences().isRestoreStarredOnly(), getPreferences().getMaxItemsPerRestore(), 0);
final AuthPreferences authPreferences = new AuthPreferences(this);
new RestoreTask(this, converter, getContentResolver(), new TokenRefresher(service, new OAuth2Client(authPreferences.getOAuth2ClientId()), authPreferences)).execute(config);
} catch (MessagingException e) {
postError(e);
}
}
Aggregations