android-syncadapter

ContentProvider won't show up in Data & Synchronization area

早过忘川 提交于 2019-12-04 07:28:44
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=".sync.SyncService" android:exported="true" android:process=":sync"> <intent-filter> <action android:name

Android SyncAdapter Callback

梦想与她 提交于 2019-12-04 04:44:48
I have implemented a SyncAdapter, AccountManager and private ContentProvider along the lines of the SimpleSyncAdapter sample project in the SDK. It is all working well. Now I want to show a message to the user when new rows have been downloaded from the remote server that have a specific flag set. I need a callback from the SyncAdapter when a Sync has finished so I can do the query and display the message from an activity. I have seen a few questions on StackOverflow discussing this but none with a good answer. How does one listen for progress from Android SyncAdapter? says that the

Syncing a REST service with an android app

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 03:29:12
There's a REST service that I use to populate info in my database, that is later used by my app. I've read several threads on the matter, and now have to decide how I want the sync between the REST service and my DB to work. Think of an app that gets info from google finance APIs about stocks and stores it in a DB, displays the information when the app is launched, and sends notifications when specific events happen in the stock price. I already implemented the simple option of AsyncTask that is launched when a user manually requests a sync. Now I have to implement the auto-sync and these are

AccountManager does not add custom account in Android N preview

ぃ、小莉子 提交于 2019-12-04 00:42:40
I have implemented a sync adapter in my app which requires an account to be added in the device account settings. I followed the same approach given in the Android docs. It works fine till Marshmallow and I can see my account listed in the device accounts. But in Android N preview, account does not add to the device accounts. AccountManager's addAccountExplicitly() method always returns false. Has anyone faced this problem? Not sure if this is the same issue, but there's an issue with AccountManager on the current version of the Android N image. Basically, if you: Add an account to

SharedPreference committed in SyncAdapter not updated in Activity?

喜夏-厌秋 提交于 2019-12-04 00:09:18
I am changing and committing a SharedPreference in my SyncAdapter after successful sync, but I am not seeing the updated value when I access the preference in my Activity (rather I am seeing the old value). What am I doing wrong? Different Contexts? My SyncAdapter where I update the preference: class SyncAdapter extends AbstractThreadedSyncAdapter { private int PARTICIPANT_ID; private final Context mContext; private final ContentResolver mContentResolver; public SyncAdapter(Context context, boolean autoInitialize) { super(context, autoInitialize); mContext = context; mContentResolver = context

First time sync loops indefinitely

可紊 提交于 2019-12-03 16:29:05
I'm having a situation with SyncAdapter I don't know how to fix. I'm using periodic syncs. The onPerformSync method just logs some info for me to know that the process is working (no calls to notifyChanges in content providers or anything else). The project consists of two apps: The first one creates a user account (for testing purposes only). The second holds the sync adapter. Note that this is perfectly legal for the scope of the project. I first install the app with the account. I can see the account has been created. Then I install the app with the sync adapter and the first time it runs

Android: Get updated and deleted contact only

我只是一个虾纸丫 提交于 2019-12-03 14:46:39
问题 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

Android SyncAdapter use case

安稳与你 提交于 2019-12-03 11:19:40
问题 What we are doing currently? We have some structured, textual data on a server which is exposed using web services(RESTful). My application polls this server regularly(AlarmManagerService) to fetch the data and save it on local database(sqlite). Also, a user is authenticated and authorized beforehand for access. Questions: There is a SyncAdapter/AccountManager class in the SDK and I was wondering if it can be of any use in my application to achieve the syncing mentioned above? If yes, what

SyncAdapter Without an Account

本小妞迷上赌 提交于 2019-12-03 09:47:38
问题 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

How do I implement an Account on Android without a SyncAdapter

让人想犯罪 __ 提交于 2019-12-03 06:17:39
问题 I am implementing a login system for an Android application utilizing the built-in accounts system (with the AccountManager APIs). All is well and good on Android 2.2+, but on Android 2.1 not including a SyncAdapter causes reboots in the account settings screen (see http://code.google.com/p/android/issues/detail?id=5009 and AccountManager without a SyncAdapter?) To get around this I implemented a stub SyncAdapter, which just returns null from IBinder onBind(Intent intent) , and added the