android-syncadapter

SyncAdapter running animation - how to know if SyncAdapter is actively synchronizing

旧城冷巷雨未停 提交于 2019-12-03 06:10:07
问题 I want to show a ProgressBar in the ActionBar while my SyncAdapter is actively synchronizing content to and from the web. I have tried using the SyncStatusObserver together with ContentProvider.addStatusChangeListener. However, I cannot check if a SyncAdapter is actively running. I can only check: SyncAdapter is pending using ContentResolver.isSyncPending SyncAdapter is pending OR actively working using ContentResolver.isSyncActive These flags can be combined: !isSyncPending && isSyncActive

SyncAdapter periodicsync() not triggering

二次信任 提交于 2019-12-03 04:33:08
问题 I'm trying ty figure out how the syncAdapter works, I used the sampleSync Adapter as an example/starting point and I based my first test on it. The only difference is that I'm not working with the default contacts provider, but that I need one of my own. This method is kinda the same as in the sampleSyncAdapter demo (in AccountAuthenticatorActivity), i've just added the periodic sync. public void finishLogin(String authToken) { Log.i(TAG, "finishLogin()"); final Account account = new Account

Display custom sync adapter as an option when adding contacts

☆樱花仙子☆ 提交于 2019-12-03 04:05:49
I am writing a custom sync adapter following the example in the SDK sample, and things seem to be working well. I can sync back contacts from my server and have them appear in the Contacts app. However, I am unable to add a contact directly to my server. Specifically, I want my sync adapter to appear as an option in the Spinner on the add contact screen, in addition to Google and Corporate, as shown in the screenshot. I couldn't find anything on the interwebs that talks about this. Ok I figured it out. Turns out the contacts.xml file defining a ContactsAccountType that ships with the SDK

How to handle RESTful update of remote server with SyncAdapter

强颜欢笑 提交于 2019-12-03 03:47:12
问题 I've watched the Google I/O REST talk and read the slides: http://www.google.com/events/io/2010/sessions/developing-RESTful-android-apps.html I'm still a bit unclear on how to nicely handle, say, an update error thrown by the remote server. I have implemented my own ContentProvider and SyncAdapter. Consider this scenario: Update a user's Contact Details via REST call: Request an update using a ContentResolver. My ContentProvider immediately updates the app's local Sqlite database and requests

Android: Get updated and deleted contact only

一世执手 提交于 2019-12-03 03:41:34
I am developing an application in which i am working on Android Contacts and not able to move ahead. In app the need of application is that the contact which is updated should send to server or the contact which is deleted should send to server for sync. I am using the contact service as: public class ContactService extends Service { private int mContactCount; Cursor cursor = null; static ContentResolver mContentResolver = null; // Content provider authority public static final String AUTHORITY = "com.android.contacts"; // Account typek public static final String ACCOUNT_TYPE = "com.example

When SyncAdapter runs synchronization on android?

十年热恋 提交于 2019-12-03 00:55:23
问题 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? 回答1: 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

SyncAdapter Without an Account

我与影子孤独终老i 提交于 2019-12-03 00:23:25
I'm trying to create a SyncAdapter for my Android app to show YouTube videos from one specific channel. The videos are public domain so I don't want the user to login, create an account, authenticate themselves, upload data, or use the contacts database. I simply want the SyncAdapter to periodically update my app's database with the newest video metadata from that channel. I already built a ContentProvider to access my database. I do like the fact that the SyncProvider will handle the ability to turn off syncing, scheduling, and retry backoff mechanisms for updating. I asked earlier if a

Login in twice when using SyncAdapters

空扰寡人 提交于 2019-12-02 19:28:00
I am creating a new Android app using SyncAdapter to handle db sync. I have everything in place and the app is working fine but I noticed that I am logged in twice. The first login takes place when the AuthenticatorActivity class (it extends AccountAuthenticatorActivity ) validates the user and password. If the user and password are correct the AuthenticatorActivity then does: If the account didn't exist it creates it using mAccountManager.addAccountExplicitly() The authToken is saved using intent.putExtra(AccountManager.KEY_AUTHTOKEN, authToken); This was basically copied/pasted from the

SyncAdapter periodicsync() not triggering

一曲冷凌霜 提交于 2019-12-02 17:44:14
I'm trying ty figure out how the syncAdapter works, I used the sampleSync Adapter as an example/starting point and I based my first test on it. The only difference is that I'm not working with the default contacts provider, but that I need one of my own. This method is kinda the same as in the sampleSyncAdapter demo (in AccountAuthenticatorActivity), i've just added the periodic sync. public void finishLogin(String authToken) { Log.i(TAG, "finishLogin()"); final Account account = new Account(mUsername, "be.company.syncAdapterTest"); if(mRequestNewAccount) { mAccountManager.addAccountExplicitly

How to handle RESTful update of remote server with SyncAdapter

橙三吉。 提交于 2019-12-02 17:13:11
I've watched the Google I/O REST talk and read the slides: http://www.google.com/events/io/2010/sessions/developing-RESTful-android-apps.html I'm still a bit unclear on how to nicely handle, say, an update error thrown by the remote server. I have implemented my own ContentProvider and SyncAdapter. Consider this scenario: Update a user's Contact Details via REST call: Request an update using a ContentResolver. My ContentProvider immediately updates the app's local Sqlite database and requests a Sync (as per recommendations in the Google I/O talk). My SyncAdapter.onPerformSync() is called and