Questions tagged [contentobserver]

Receives call backs for changes to content. Must be implemented by objects which are added to a ContentObservable.

Receives call backs for changes to content. Must be implemented by objects which are added to a ContentObservable.

It has the following public meathods

Public Methods

boolean deliverSelfNotifications()

Returns true if this observer is interested receiving self-change notifications.

final void dispatchChange(boolean selfChange, Uri uri)

Dispatches a change notification to the observer.

final void dispatchChange(boolean selfChange)

This method was deprecated in API level 16. Use dispatchChange(boolean, Uri) instead.

void onChange(boolean selfChange, Uri uri)

This method is called when a content change occurs.

void onChange(boolean selfChange)

This method is called when a content change occurs.

259 questions
5
votes
1 answer

How to get phone call log history of organisation work profile in my application (Published as Private app)

Here I am trying to get last call log history in my application after call ended with released apk (Published on play store as public app). Now I have released my app as private app for one organization I am not able to get call log history in my…
5
votes
0 answers

Check for contacts having app installed

I am building an application where users are able to interact with the contacts of their device(using phoneNumber) who have this application installed ( pretty much how Whatsapp, Viber function) Now this functionality can be achieved by a function…
Yashveer Rana
  • 548
  • 3
  • 15
5
votes
3 answers

Android History Content Observer

I implemented content observer of history but it is behaving weird.For every change in history its onChange() function runs 3-5 times. static class BrowserOberser extends ContentObserver { public BrowserOberser() { super(null); } …
Aditya
  • 5,509
  • 4
  • 31
  • 51
5
votes
1 answer

How to implement a ContentObserver in a fragment using CursorAdapter and LoaderCallbacks?

I am using a CursorAdapter in a ListFragment to load and display a list of comments. public class CommentsFragment extends ListFragment implements LoaderCallbacks { protected Activity mActivity; protected CursorAdapter mAdapter; …
5
votes
1 answer

Sqlite Database updates triggers Service to update via Content Observer

I'm trying to use a Content Observer to update a Service when any changes happen to the sqlite database in my app. I'm confused as to what to do, so I put together some code below. Usually, Content Observers are used with contacts or mediaplayer…
Leoa
  • 1,167
  • 2
  • 14
  • 31
5
votes
1 answer

ContentObserver used for SMS

I'm trying to extract the sent SMS. I know there is no BroadcastReciver for this. So I've found that I can use ContentObserver to listen changes in the db. How can I implement this? My objective is to get only the new sms sent and send it via POST…
Marc Ortiz
  • 2,242
  • 5
  • 27
  • 46
4
votes
2 answers

ContentObserver is called even when there are no changes in the cursor

I have a content observer that should be notified when one of the contacts added by my sync adapter is modified. I register and unregister the observer doing this: private static final Uri MYAPP_CONTENT_URI =…
kingston
  • 11,053
  • 14
  • 62
  • 116
4
votes
1 answer

How to observe changes in database in order to update LiveData

I am migrating an app from a LoaderManager with Callbacks to an implementation using ViewModel and LiveData. I would like to keep using the existing SQLiteDatabase. The main implementation works OK. The Activity instantiates the ViewModel and…
Paul Naveda
  • 724
  • 8
  • 16
4
votes
1 answer

Android - Observer DB changes with GreenDao ORM

I'm using GreenDao in one of my android projects. I'm trying to implement an observer/listener for when changes are done. So far I created a static-functions basic functions (save, replace and delete) that just post an event (via EventBus), but this…
4
votes
1 answer

Android: Is it possible to listen for only insert and update operations using ContentObserver

Actually, I have a table for which I am listing for changes using ContentObserver, and in OnChange(), I am triggering a SyncCall. My requirement is to make a SyncCall only on insert or update operation and if the operation is delete, I dont want to…
Akhil
  • 189
  • 7
4
votes
2 answers

Android, Listener/Observer/Callback on calendar event change

I am writing an application that needs to know when a meeting is added/removed/changed in the calendar. I know how to get all the data from a calendar using CursorLoader on the calendar uri. Also i know how to listen to calendar changes using the…
4
votes
1 answer

how to unregister content observer in preferences

I m working on application where i got a task to work on preference so implemented switch preference where if switch is on i have to monitor contact database so i used content observer and when user switchoff i have to unregister that content…
Nawaf
  • 424
  • 5
  • 17
4
votes
1 answer

Android onChange event not triggered in contentObserver for chrome history on android 5 (Lollipop)

I've noticed that my contentObservers for chrome history and bookmarks do not trigger anymore on android lolipop. The code works perfectly on older versions of android (regardless of the chrome version) but on Lollipop it is not working…
4
votes
0 answers

Android ContentObserver : how to detect newly added contact in android contact list?

on change in contact list this service is called which is mention below . i am not getting any newly added contact using this code .is there any alternative for this ?? My MyContactService is as below : public class MyContactService…
Radhey
  • 2,139
  • 2
  • 24
  • 42
4
votes
0 answers

Listen for changes to individual android contacts

I have a list of phone numbers and I need to be notified when changes occur to the contacts with those numbers in android contacts database. What I tried so far: 1st method: Register a…
1 2
3
17 18