android-syncadapter

Android multiple sync adapter items like Google Account?

一笑奈何 提交于 2019-12-30 01:08:29
问题 I currently have my Android app set up to use the AccountManager feature of Android, using a SyncAdapter and an authenticated account to performs syncs automatically. I only have 1 sync adapter running which syncs all content, but I would like to separate this out to performs syncs for different content at different intervals. How can I have multiple sync items like Google does? 回答1: You just have to define several sync adapters, using the same account type. The manifest contains: <service

Using AlarmManager to sync data with a server

与世无争的帅哥 提交于 2019-12-25 06:20:57
问题 First of all, I apologize for my English. I need to sent data to a server and query for data in that server from time to time, maybe from week to week. So I'm going to use the AlarmManager to do that. I wanna know if I can register two separated pending intents in the alarm manager, one to push data to the server, and another one to query data from the server. Can I register those two intents every time the application executes? Or do I need to test if I already got those intents registered?

Android SyncAdapter: retry

你离开我真会死。 提交于 2019-12-25 03:32:49
问题 I'm using an AbstractThreadedSyncAdapter to synchronize some data with my server. I'm using SyncResult to indicate if there's been an error while performing the synchronization: syncResult.stats.numParseExceptions++; I initialize the SyncAdapter like this: Bundle params = new Bundle(); params.putBoolean(ContentResolver.SYNC_EXTRAS_EXPEDITED, false); params.putBoolean(ContentResolver.SYNC_EXTRAS_DO_NOT_RETRY, false); params.putBoolean(ContentResolver.SYNC_EXTRAS_MANUAL, false); ContentResolver

Re initate Sync adapter in android

岁酱吖の 提交于 2019-12-25 02:57:34
问题 I'm able to successfully create Sync adapter in my phone, but i'm not able to handle a particular scenario. My task sync app, requires the tasks permission to fetch tasks or it applicable for getting permission for any service from Google server. this scenario occurs for the first time, if the user moves to Google account without launching the application. 1) Go to Settings --> Accounts and sync --> Choose a Google account, 2) there the tasks sync content provider will be present. 3) Once i

Failed to fire broadcast receiver in Android Oreo

余生长醉 提交于 2019-12-24 05:52:44
问题 Using SyncAdapter and AbstractThreadedSyncAdapter https://riptutorial.com/android/example/32303/sync-adapter-with-every-min-requesting-value-from-server- I have registered receiver in manifest and from SyncAdapter broadcast register its working fine before Oreo but in Oreo, broadcast receiver failed to fire. Intent intent = new Intent(); intent.setAction("package.qa.ACTION_SYNC"); intent.putExtra("OUTBOX_ID", outboxId); intent.putExtra("JSON_RESPONSE", jsonResponse); intent.putExtra("TRANS

android contacts provider: how to set phone number primary

眉间皱痕 提交于 2019-12-23 17:15:59
问题 How to set a contact's phone number to be primary number when adding or updating a contact building a custom contacts provider. The adding and updating of contacts is working fine but I don't know how to set one number of the contact to be primary, or default number. 回答1: mValues.put(Phone.IS_PRIMARY, 1); mValues.put(Phone.IS_SUPER_PRIMARY, 1); Both Phone.IS_PRIMARY and Phone.IS_SUPER_PRIMARY have to be set. 回答2: I had the same problem, my solution is: ContentProviderOperation.Builder bld =

How to setup administrators in Couchdb via Apache's HttpClient (given a curl example)

喜你入骨 提交于 2019-12-23 05:29:05
问题 So I am working on a CouchDB Gui Toolbox for easier maintaining an setting up CouchDB on Android, as Futon is quite uncomfortable on a small mobile device. I wanted to stick to the "org.apache.http.client.*" packages for this which was working out quite well until I wanted to setup administrators.. With the commandline tool "curl" it works like a charm: curl -X PUT http://127.0.0.1:5984/_config/admins/username -d '"password"' But I keep on having big problems translating that to a "org.apache

How to define frequency of SyncAdapter updates on android?

泄露秘密 提交于 2019-12-22 10:34:00
问题 ContentProvided defined for synchronization is dummy (in accordance with this approach). 回答1: If API > 8, (95% of devices) use ContentResolver.addPeriodicSync() If API = 7, (5.5% of devices as of Mar 2102) create a service with a periodic timer callback, and call ContentResolver.requestSync() . API < 6 does not support syncAdapter, so no worries. 来源: https://stackoverflow.com/questions/5525593/how-to-define-frequency-of-syncadapter-updates-on-android

What are Android SyncAdapter contentAuthority and accountType?

旧时模样 提交于 2019-12-22 05:26:19
问题 I'm creating a custom Android SyncAdapter and hit a snag following the SDK example "SampleSyncAdapter". - I'm creating my equivalent of the xml/syncadapter.xml . Here's the parts I'm confused about: android:contentAuthority="com.android.contacts" android:accountType="com.example.android.samplesync" The documentation of AbstractThreadedSyncAdapter states: The android:contentAuthority and android:accountType attributes indicate which content authority and for which account types this sync

Using ContentResolver instead of ContentProviderClient in SyncAdapter

╄→尐↘猪︶ㄣ 提交于 2019-12-22 04:42:49
问题 As I understand from the docs, one SyncAdapter defined in a SyncService is limited to receive only one ContentProvider authority to work on. But, at the same time, it has access to ContentResolver which it allows to run queries on other ContentProviders as well. I don't understand this particular design concept if a developer is needed to provide a single content authority to SyncAdapter and nonetheless she is able to do whatever she wants on whatever ContentProvider she has access to. My