@Override protected void onPostExecute(final List<String> result) { PersonalPhonebookActivity.endProgress(); HttpRequestManager.doRequest( Settings.getBackupURL(), Settings.makeRequestParameter(ActionParameterValue.PERSONAL_CONTACT_BACKUP_COMPLETE, null)); cacheAfterBackup(); }
@Override protected void onPreExecute() { // We are starting back up. HttpRequestManager.doRequest( Settings.getBackupURL(), Settings.makeRequestParameter(ActionParameterValue.PERSONAL_CONTACT_BACKUP_STARTED, null)); ContentResolver cr = activity.getContentResolver(); cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null); int max = cur.getCount(); PersonalPhonebookActivity.showProgress( "Backing up, Please wait...", activity, this, true, max, true, "Are you sure you want to stop Backing up?"); }
private void uploadContacts(final List<String> r) { show("flushing contacts"); List<String> result = r; final Iterator<String> contacts = result.iterator(); while (contacts.hasNext() && !super.isCancelled()) { try { // update progress PersonalPhonebookActivity.updateProgressBar(uploadedCount++); } catch (Exception e) { e.printStackTrace(); } try { String contact = contacts.next(); HttpRequestManager.doRequest( Settings.getBackupURL(), Settings.makeBackupAESParameters(contact)); } catch (Exception e) { Log.e("Error:", e != null && e.getMessage() != null ? e.getMessage() : "Unknow Error"); e.printStackTrace(); } } }