android-syncadapter

Synchronize Android client and REST server

时光怂恿深爱的人放手 提交于 2019-11-29 10:55:53
REST Server I created a Rails server that contains :users and associated :comments . It is used as a backend API for an Android client. The exchange format to load and store data at the server is JSON. Here are the relevant migrations. class CreateUsers < ActiveRecord::Migration def change create_table :users do |t| t.string :name t.timestamps end end end ... class CreateComments < ActiveRecord::Migration def change create_table :comments do |t| t.references :users t.string :subject t.text :message t.timestamps end end end All users have already been imported. Therefore, only read access is

Does SyncAdapter get notified when AccountManager removes account?

孤者浪人 提交于 2019-11-29 03:47:44
问题 So, my question restated is when you go to Settings -> Accounts & Sync and select the an account that was created that your SyncAdapter is syncing with a cloud server, and select remove account, what happens as far as your SyncAdapter is concerned? There is a dialog that displays asking you to confirm and that the data on the phone associated with that account will be removed. I cannot easily believe that the framework can automatically remove the data my SyncAdapter has stored in the local

Android SyncAdapter Automatically Initialize Syncing

本秂侑毒 提交于 2019-11-28 17:48:54
问题 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

Show settings under accounts & sync menu for android app

怎甘沉沦 提交于 2019-11-28 17:19:14
I am implementing a syncadapter for an android app and would like to make the settings for the account available under the "Accounts & sync" menu. I have seen this done in the DropBox app(as shown below), but I have not been able to find documentation on how to do this. I have the accounted added, just want to add a link to the account settings in this menu. In your Android Manifest, you should have a section like this to define your account authenticator: <service android:name="AccountAuthenticatorService" android:exported="true" android:process=":auth"> <intent-filter> <action android:name=

How do I use the Android SyncAdapter?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-28 15:14:54
I try to understand the Android synchronization logic. What I don't understand is the file syncadapter.xml contained in the Android SDK sample project SampleSyncAdapter . If you downloaded the SDK samples it should be in the following folder: SDK/android-sdk-PLATFORM/samples/android-VERSION/SampleSyncAdapter/res/xml/syncadapter.xml I read, the authority of a content provider should be a string or a reference to a resource. What exactly is the content authority and where is com.android.contacts ? Here is the content of the file (w/o license information and comments, API level 16). <sync-adapter

Read and write ROOM database SYNCHRONICALLY everywhere

大城市里の小女人 提交于 2019-11-28 14:03:07
问题 I have been analyzing the way of reading and writing a ROOM database SYNCHRONICALLY without the need of a Content Provider or BroadcastReceiver . Obviously the database access must be asynchronous. I have found a solution that makes the asynchronous task to be transparent to the programmer, using Callable and Future interfaces that allows me to make direct calls to the database within the main thread, as well as from any other part of the application. The advantages is having almost direct

How does one listen for progress from Android SyncAdapter?

我的梦境 提交于 2019-11-28 10:19:52
I recall reading about a broadcast receiver interface from the sync adapter or some ResultReceiver of sync progress events. Is there something built into the SyncAdapter pattern or is it home-grown? What works: The method suggested in a 2010 Google IO session, Developing Android REST client applications is to place columns into your ContentProvider as tags to indicate that a record is being fetched or placed or etc. This allows a per-row spinner (or other visual change) to be placed in your UI. You might do that through a custom CursorAdapter that drives a ListView. Your ContentProvider is on

honeycomb sync adapter features for editing contacts

喜欢而已 提交于 2019-11-28 06:15:23
问题 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

How to show sync failed message

一曲冷凌霜 提交于 2019-11-28 05:34:36
问题 I've build a contacts sync adapter. It's all working fine but I need one more thing. If for some reason the sync does not complete successfully, I want to show a message like Google account is showing when the sync fails 回答1: The solution was to set the delay on the sync result. After this delay the sync will be restarted. try { DO THE SYNCHRONIZATION } catch (AuthenticationException e) { Log.e(TAG, "AuthenticationException"); syncResult.stats.numAuthExceptions++; syncResult.delayUntil = 180;

Synchronize Android client and REST server

给你一囗甜甜゛ 提交于 2019-11-28 04:18:03
问题 REST Server I created a Rails server that contains :users and associated :comments . It is used as a backend API for an Android client. The exchange format to load and store data at the server is JSON. Here are the relevant migrations. class CreateUsers < ActiveRecord::Migration def change create_table :users do |t| t.string :name t.timestamps end end end ... class CreateComments < ActiveRecord::Migration def change create_table :comments do |t| t.references :users t.string :subject t.text