android-syncadapter

SyncAdapter vs JobScheduler

大城市里の小女人 提交于 2019-12-22 03:25:48
问题 Excluding the fact that JobScheduler only supports API > 21 - are JobSchedulers designed to fully replace SyncAdapters ? Or does SyncAdapter contain any functionality lacking by JobScheduler ? My use case is syncing an RSS feed every couple of hours. This is doable with a JobScheduler - right? 回答1: I would say JobScheduler is not a direct substitution for SyncAdapter , which has a much more specialized purpose (transferring data between the device and a server). JobScheduler , on the other

ContentProvider won't show up in Data & Synchronization area

微笑、不失礼 提交于 2019-12-21 17:05:30
问题 I'm trying to get a custom ContentProvider to show up under Data & synchronization, and I'm running into some problems. Namely, it's not showing up. The specifics: My AndroidManifest.xml has the provider and service: <provider android:name="BooksProvider" android:label="ClientName Books" android:authorities="com.clientname.reader.books" android:enabled="true" android:exported="true" android:syncable="true"> <grant-uri-permission android:pathPattern=".*" /> </provider> <service android:name="

Login in twice when using SyncAdapters

旧街凉风 提交于 2019-12-20 09:23:16
问题 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

syncadapter without internet connection

偶尔善良 提交于 2019-12-19 08:17:30
问题 I have a sync adapter that works fine. It does not need internet connection because it needs to sync the addressbook with another local storage (my application). When the Wifi is turned off and the device does not have any internet connection Android disables the sync in the Account & Synch settings activity. Is there a way to keep my synch adapter on even when the connection is off? 回答1: Well there is no way, SyncAdpater framework won't work without internet connection So its better to Re

general sync settings “auto-sync” checkbox programmatically

爷,独闯天下 提交于 2019-12-19 06:40:32
问题 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

general sync settings “auto-sync” checkbox programmatically

僤鯓⒐⒋嵵緔 提交于 2019-12-19 06:40:04
问题 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

How to enable sync without syncing every few seconds

安稳与你 提交于 2019-12-19 04:07:23
问题 I have used Google's Android developer documentation (http://developer.android.com/training/sync-adapters) to create a syncing system. My app now has an entry in Android Settings under Accounts. When I tap this entry, I see the sync adaptor I have configured. Everything looks ok except that the box is unchecked and it says "Sync is OFF". I have Googled and Stackoverflowed and there seems to be one way to enable sync, as explained here: https://stackoverflow.com/a/5279191/127434. The answer at

Dirty flag not getting set to “1” on contact update

拟墨画扇 提交于 2019-12-18 09:29:45
问题 I am working on a project in which I want to detect the changes in the Contacts. So I have created Account with Account manager and trying to find the changes in the contact list using DIRTY flag. But the DIRTY flag not getting set for my app account_type when contact updated. however DIRTY flag of another account_type(com.google) is getting set. Help me This is how I am inserting contacts with my account and account_type. public static void addContact(Context context,MyContact contact){

open an activity to edit contact in sync adapter

对着背影说爱祢 提交于 2019-12-18 07:23:04
问题 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

New contact creating rather than updating existing contact

梦想的初衷 提交于 2019-12-18 07:05:45
问题 I am integrating my app with android default Contacts application.I would like to show an option "xyz using MyApp" inside every Contacts Detail.I am able to see my app in Accounts Section with an option to sync Contacts but still my app not merging with existing contacts but instead creating a new contact and merging in it. performSync() method private static void addContact(ContentResolver contentResolver,int name, int phoneNumber) { Log.i("XYZ", "Adding contact: " + name); ArrayList