android-syncadapter

How to post a message from a background service to a UI fragment?

自作多情 提交于 2019-12-07 08:15:21
问题 I have an issue with EventBus from Greenrobot. I was trying to post an event from a background service form my sync adapter and catch it in a fragment to update the UI. The problem is that when I try to post the event from sync adapter I have get the following in the debug log: No subscribers registered for event class olexiimuraviov.ua.simplerssreader.event.UpdateUIEvent No subscribers registered for event class org.greenrobot.eventbus.NoSubscriberEvent I register fragment in onResume and

data & synchronization - manually sync mail. calender and contacts

六月ゝ 毕业季﹏ 提交于 2019-12-07 05:35:46
问题 I am trying to write an app that syncs my mail and my calender with just a single click. After looking through this forum I found some good hints and wrote a short test app that takes my first google account and starts syncing. The code is working so far but currently only the contacts were synced! AccountManager am = AccountManager.get(this); Account[] acc = am.getAccountsByType("com.google"); Account account = null; if (acc.length > 0) { account = acc[0]; Bundle extras = new Bundle();

How to signal sync-complete to the Android SyncManager?

女生的网名这么多〃 提交于 2019-12-07 04:15:24
问题 I was using cancelRequest() from within my SyncAdapter, just before it exits its thread, but I then decided that was only intended to be used by another entity (UI) that wants to cancel a sync in progress (taking too long, oops, etc.) Now my sync thinks there is always a pending request - which I use to ignore new requests. The other thing that I have going is a listener thread in a Service that is listening for changes to the ContactsContract.AUTHORITY so it can kick off a sync of my

IllegalArgumentException: addAccount not supported

别等时光非礼了梦想. 提交于 2019-12-07 01:02:39
问题 I followed this description to add my sync adapter. But there is a litte bug :-( When I open Settings -> Account -> Add account and select my account I get this error message java.lang.IllegalArgumentException: addAccount not supported at android.accounts.AccountManager.convertErrorToException(AccountManager.java:2147) at android.accounts.AccountManager.-wrap0(AccountManager.java) at android.accounts.AccountManager$AmsTask$Response.onError(AccountManager.java:1993) at android.accounts

How to build a syncadapter for the google calendar?

。_饼干妹妹 提交于 2019-12-06 12:28:37
问题 I'm building an application for students to manage the courses of a university. Now I would like to synchronize the events (an event has a date and time and a brief description) with the google calendar of Android. I took a look at the samplesync adapter from the Android sample, but I didn't find it very useful for the calendar. The sync of the app should be enabled and disabled from the settings of the app with a checkbox. Does anyone has some sample code that can be useful?? 回答1: Use

How can I add a category to my SyncAdapter

不羁的心 提交于 2019-12-06 05:20:48
问题 I have tried the great Google example to sync contact from a webservice and that work fine. This is called the SampleSyncAdapter and really worth it: http://developer.android.com/resources/samples/SampleSyncAdapter/index.html I succed everything, but I cannot found in the example nor in the documentation a way to add a category that would link to a custom activity, exactly like the screenshot below: (I have only the sync account option with the checkbox) So, my question is: how can I add the

Android : Sync Adapter not running in some devices

二次信任 提交于 2019-12-06 03:46:48
In my android project i have a sync adapter that will sync data from android device to the server and its working fine, but recently i noticed that the onPerfomSync is not calling in my moto g3 android phone, I don't know whether there is the same problem in any other phones,I have tested it in some other Samsung phones with different android api level,but didn't find any problem there.I have configured the sync when a successful user login found.What will be the reason for this behaviour.Correct me if i am doing anything wrong. Below is my codes. private void finishLogin(Intent intent) {

How to handle REST calls, data persistence, syncing and observing ContentProvider

眉间皱痕 提交于 2019-12-06 01:59:38
问题 I know that this question has been asked too many times, but I think the issues I'm trying to target are a little bit different, maybe more complicated. I am going to develop an application that uses a RESTful Web Service and needs to have the following requirements: the app should show some books, their authors and their editors in lists and in detail the app should also allow searching for a book books, authors and editors are fetched from a RESTful web service every entity has to be cached

Android SyncAdapter Callback

匆匆过客 提交于 2019-12-05 20:38:25
问题 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

Refreshing fragments in FragmentActivity after sync service runs

别说谁变了你拦得住时间么 提交于 2019-12-05 20:18:17
does anybody have any elegant solution for refreshing the Views in Fragments in a FragmentActivity's ViewPager after a sync Service from a SyncAdapter runs? I've tried calling notifyDataSetChanged() and notifyDataSetInvalidated() on my adapter, as well as refreshDrawableState() on my views ( GridViews ), but to no avail. Perhaps I've been calling them from the wrong places -- I've tried doing it at setUserVisibleHint where isVisible =true, hoping to trigger it whenever the fragment comes into view, but it doesn't work. I've also been using ASync calls to the SQLite database for my data needs,