android-syncadapter

When SyncAdapter runs synchronization on android?

核能气质少年 提交于 2019-12-02 14:19:05
Let's say, my application implements SyncAdapter functionality and doesn't define periodic syncs. When synchronization will happen in such scenario? First scenario I may think about is local ContentProvided/database content change. What is about server changes? How SyncAdapter will know about that? If you have no periodic sync setup, Sync will happen if your code explicitly calls ContentResolver.requestSync(Account account, String authority, Bundle extras) with your account and authority. Also, if your ContentProvider insert or update or delete functions call ContentResolver.notifyChange(Uri

How to use CALLER_IS_SYNCADAPTER properly

元气小坏坏 提交于 2019-12-02 00:52:08
问题 somehow I don't understand the working concept of the query parameter CALLER_IS_SYNCADAPTER. Its default value is false, if set, the DIRTY flag is not automatically set. So what does it actually mean? Out from my understanding, each change on a contact results in setting the dirty flag to 1. After a sync adapter finished the job, using insert/update/delete with the CALLER_IS_SYNCADAPTER the inserted/updated and deleted records should have a dirty flag of 0, is that right? However if I invoke

ContentResolver.requestSync in Sync Adapter is not working in Android

瘦欲@ 提交于 2019-12-01 16:57:16
I am trying to write a sync adapter with 'StubProvider' and 'StubAuthenticator', i followed the offical guidelines, my code is running without any errors but 'onPerformSync()' is NOT getting called, i tried everything but no use. My full project can be downloaded from https://www.dropbox.com/s/48bgj3wweehaieu/MyApplication.zip?dl=0 Here are the classes I am using: Class MainActivity public class MainActivity extends FragmentActivity implements View.OnClickListener { // Constants // The authority for the sync adapter's content provider public static final String AUTHORITY = "com.syncadaptertest

general sync settings “auto-sync” checkbox programmatically

不问归期 提交于 2019-12-01 04:56:59
I am looking for a way to enable/disable the "auto-sync" checkbox in the "general sync settings". Afair the stock power control widget has this feature too. If this widget can do, there should be a solution for me too, right? Please guys help me out, I am desperately looking for a solution on the web with no success. Is it possible that a user interaction is mandatory for this operation? I know I can send an Intent to open the Sync View but this is not my intention! I am not looking for the sync settings for a specific account as I found in this forum like ContentResolver.setSyncAutomatically

Use SyncAdapter to sync with *local* gmail and facebook app data

百般思念 提交于 2019-11-30 23:59:49
问题 For an app I need to develop, I need to be able to sync with both gmail and facebook data using a SyncAdapter. I'm hoping to sync with the local facebook and gmail apps (if available) instead their remote servers. Syncing with the local apps would mean less battery usage, less network usage, faster syncing, etc. Of course, if needed, I will set the correct permissions. My questions : If any of the apps (gmail/facebook) are available, is it possible to query them for data (messages, events,

Hide dummy Account for Sync Adapter from Settings

别等时光非礼了梦想. 提交于 2019-11-30 10:51:34
问题 I have created a Sync Adapter with a dummy Account and I don't want it to appear on the Account list in the Settings application, nor when a user presses the add account button in Settings. I have tried android:userVisible="false" in my sync-adapter definition, but still the account appears. I've tried this on an emulator and 3 physical devices. Everything works correctly in terms that it syncs all the data I need, the only thing wrong is that I see the Account on the list, and I don't want

Android SyncAdapter Automatically Initialize Syncing

痴心易碎 提交于 2019-11-29 21:53:56
I have a SyncAdapter for my app, and an AccountManager to add my apps accounts to the Android Account Manager. My code for when I add an account to the Account Manager looks like: Bundle data = new Bundle(5); data.putString(_PEOPLE_ID, people_id); data.putString(_FIRST_NAME, first_name); data.putString(_LAST_NAME, last_name); data.putString(_PLAN, plan); data.putString(_BIRTHDAY, birthday); Account account = new Account(username, _ACCOUNT_TYPE); try { boolean created; created = _account_manager.addAccountExplicitly(account, _cryptography.encrypt(_SEED, password), data); response.accountCreated

Hide dummy Account for Sync Adapter from Settings

女生的网名这么多〃 提交于 2019-11-29 21:28:44
I have created a Sync Adapter with a dummy Account and I don't want it to appear on the Account list in the Settings application, nor when a user presses the add account button in Settings. I have tried android:userVisible="false" in my sync-adapter definition, but still the account appears. I've tried this on an emulator and 3 physical devices. Everything works correctly in terms that it syncs all the data I need, the only thing wrong is that I see the Account on the list, and I don't want to. My authenticator.xml is: <account-authenticator xmlns:android="http://schemas.android.com/apk/res

open an activity to edit contact in sync adapter

笑着哭i 提交于 2019-11-29 13:08:29
In the Android SampleSyncAdapter there is the following piece of code: /** * Adds a profile action * * @param userId the userId of the sample SyncAdapter user object * @return instance of ContactOperations */ public ContactOperations addProfileAction(long userId) { mValues.clear(); if (userId != 0) { mValues.put(SampleSyncAdapterColumns.DATA_PID, userId); mValues.put(SampleSyncAdapterColumns.DATA_SUMMARY, mContext .getString(R.string.syncadapter_profile_action)); mValues.put(SampleSyncAdapterColumns.DATA_DETAIL, mContext .getString(R.string.view_profile)); mValues.put(Data.MIMETYPE,

honeycomb sync adapter features for editing contacts

偶尔善良 提交于 2019-11-29 12:48:25
I'm developing a sync adapter. I found this: http://groups.google.com/group/android-developers/msg/85f9304dfcc4e284 In that forum a google employee states: In releases of Android from Eclair through Gingerbread integrated editing of 3rd party contacts is poorly supported. The trick is to insert a data row, "Edit in MyApp", which would take the user to your app and your app would then provide an editor activity. Also, there is no provision in the Contacts UI for creating new contacts in 3rd party accounts. We have fixed those issues in Honeycomb. Now you can specify two activities in your