android-syncadapter

Android SyncAdapter stuck in infinite sync loop

て烟熏妆下的殇ゞ 提交于 2019-12-18 04:18:15
问题 I'm writing an Android Sync Adapter and basically having a problem with it syncing in an infinite loop. As soon as the sync completes it starts all over again. Thank you, Regards, Akshay @Override public void onPerformSync(final Account account, final Bundle extras, final String authority, final ContentProviderClient provider, final SyncResult syncResult) { Log.i("Sync result full sync = " + syncResult.fullSyncRequested); Log.i("Sync result " + syncResult.toDebugString()); Log.i("Bundle " +

Own sync adapter for Android?

橙三吉。 提交于 2019-12-17 17:36:27
问题 The press release of Android 2.0 states that the new release supports sync adapters so that emails and calendars cannot only be synced with gmail and exchange. However, there is no information available online how to write such a sync adapter. Has anyone tried it and some example code available? 回答1: These two articles by Sam Steele (January 23rd, 2010) are about the implementation of the last.fm sync adapter. Do not miss the second part and the opensource projects that are mentioned at the

ContentResolver.addPeriodicSync interval round up

喜欢而已 提交于 2019-12-17 16:52:05
问题 My sync adapter does work perfectly well except for one little thing which bugs the sh*t out of me for the last few hours... For my app i want the sync adapter to run with an interval of 10 seconds. ContentResolver.addPeriodicSync(mAccount, AUTHORITY, Bundle.EMPTY, 5); What happens is that the sync starts every 60 seconds instead of the requested 5 seconds. When i change the interval to 70 seconds then the sync starts every 70 seconds. From the log file: W/ContentService﹕ Requested poll

Why does ContentResolver.requestSync not trigger a sync?

青春壹個敷衍的年華 提交于 2019-12-17 02:01:16
问题 I am trying to implement the Content-Provider-Sync Adapter pattern as discussed at Google IO - slide 26. My content provider is working, and my sync works when I trigger it from the Dev Tools Sync Tester application, however when I call ContentResolver.requestSync(account, authority, bundle) from my ContentProvider, my sync is never triggered. ContentResolver.requestSync( account, AUTHORITY, new Bundle()); Edit -- added manifest snippet My manifest xml contains: <service android:name=".sync

How to get contact id after add a new contact in android?

本小妞迷上赌 提交于 2019-12-14 03:36:25
问题 I use following code for new contacts added to phone. private static void addContact(Account account, String name, String username,String phone,String email) { Log.i(TAG, "Adding contact: " + name); ArrayList<ContentProviderOperation> operationList = new ArrayList<ContentProviderOperation>(); ContentProviderOperation.Builder builder = ContentProviderOperation.newInsert(RawContacts.CONTENT_URI); builder.withValue(RawContacts.ACCOUNT_NAME, account.name); builder.withValue(RawContacts.ACCOUNT

Regulate network calls in SyncAdapter onPerformSync

房东的猫 提交于 2019-12-13 13:27:03
问题 I m sending several retrofit calls via SyncAdapter onPerformSync and I m trying to regulate http calls by sending out via a try/catch sleep statement. However, this is blocking the UI and will be not responsive only after all calls are done. What is a better way to regulate network calls (with a sleep timer) in background in onPerformSync without blocking UI? @Override public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult

android contacts sync without auth token

落花浮王杯 提交于 2019-12-13 00:13:35
问题 Is there a way to sync android contacts with server without using authToken, just username and password? How can it be done? I want to authenticate with username and password everytime i sync the contacts, without using the authToken at all. Let's say on the SampleSyncAdapter , what should I change to achieve this. 回答1: You can use the account name as the user name, and save the password either as the token as or additional info. In the SampleSyncAdapter, just replace what your sending to the

Syncadapter last update date

南笙酒味 提交于 2019-12-12 17:44:49
问题 How can obtain the last update date from the sync adapters services (marked with red) ? 回答1: Interesting. The API would (almost have to be) on android.content.ContentResolver as that's where periodic sync and enable/disable sync is managed. There's no API there to request it. Are you trying to find this value for your own SyncAdapter or for a third party app? With your own SyncAdapter, you obviously can just store date() into a single-row sqlite table within your ContentProvider and reference

SyncAdapter android:userVisible attribute not working

拟墨画扇 提交于 2019-12-12 12:20:12
问题 According to the android Documentation android:userVisible defaults to true and controls whether or not this sync adapter shows up in the Sync Settings screen. but it shows in the Settings whatever value it gets! EDIT Nov 03 2014 I removed android:icon android:label android:smallIcon from authenticator.xml and now it's not showing in the Accounts but there is an empty entry on Add Account tested on Samsung Galaxy S4. And for the record this totally crashed my 2.3.3 emulator when opening

SyncAdapter process killed when app process is terminated

社会主义新天地 提交于 2019-12-12 10:53:27
问题 Why the SyncAdapter process (:sync) is killed when the app is swiped from the app switcher list ? i thought the whole intention here is to keep them decoupled. EDIT: Following is the code used. mUploadTask is a AsyncTask im executing that reads information from a sqlite table (using getContext().getContentResolver() ) and uploads relevant data to a backend (using HttpPost ). Very straight forward. Also, i implemented only one onSyncCanceled() since my SyncAdapter doesnt support syncing of