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
0
votes
1 answer

Running service for android calendar changes?

My goal is to write an app that listens for changes in android calendar. It doesn't seem like there's support for broadcasts in this case, but what's needed is a ContentObserver. If I want a ContentObserver to run indefinitely, it requires a thread…
0
votes
0 answers

React to incoming SMS/MMS while respecting the default SMS/MMS database

Is there any way to react to changes to the SMS/MMS ContentProvider (even when app is inactive.) I want to act on message data as it comes, but also as the default Messenger app uses it. If I use a BroadcastReceiver with a…
0
votes
1 answer

Android Material Design vs ContentObserver

I will try to explain my question as best. Along my search on where to register / unregister my ContentObserver I see multiple answer saying that it should be at onResume / onPause or onStart / onStop but not in onCreate / onDestroy. Let say I had…
0
votes
1 answer

Xamarin c# Loader example?

This problem is for Xamarin Android C# , but if someone can help in java I'm sure I can convert the code over .. I'm trying to get some sort of automatic notification on a db that data has been inserted / deleted / etc. There is outside apps that…
Migz
  • 163
  • 1
  • 13
0
votes
0 answers

ContentObserver not notifed after calling

CLOSED: For some reasons it suddendly works. I checked git, i did not change a thing. I just hope it stays this way. I have a ContentObserver that is registered during the onCreate method of my first activity. I know that it is being called because…
findusl
  • 2,454
  • 8
  • 32
  • 51
0
votes
1 answer

Using ContentObserver with IntentService

I want to use IntentService as it creates a work queue and handles asynchronous requests. I am registering a ContentObserver within service. Docs say that IntentService stops itself when it runs out of work. I want my Service to stop only after…
droidmad
  • 807
  • 7
  • 13
0
votes
0 answers

Android ContentObserver Out of memory Exception

I would like to create a service which looks for new images in the Image Gallery. When the user has 30 new pictures, I would like to display a reminder like notification. For this I have created a content resolver and set up a ContentObserver, but…
0
votes
0 answers

Media ContentObserver not raising onChange events

I'm attempting to get my Android application to open up the camera application and allow the user to take a series of photos, then upon exiting, I want to use a ContentObserver to query MediaStore.Images.Media.EXTERNAL_CONTENT_URI to find the…
Colin Basnett
  • 4,052
  • 2
  • 30
  • 49
0
votes
1 answer

Android - can service be run in untill app gets uninstalled?

I need to get notified when phone contacts changed, even if my app is closed. how to do? In my code I am starting service with START_STICKY in splash screen, but when I close the app, service also starting again. When I change in contacts,…
0
votes
1 answer

distinguish between answered and unanswered outgoing calls

I want to find out if an outgoing call has been answered. Unfortunately, in the case of an outgoing call I see Intent { act=android.intent.action.PHONE_STATE flg=0x10 (has extras) } extras:Bundle{ state => OFFHOOK; }Bundle Intent {…
0
votes
1 answer

How to know if contact / phonebook list or database is updated android?

I have implemented a sync adapter which sends all my contacts over the server. But now I am faced with the issue that how the system can respond if it contact list has been updated. I used the content observer to find out but it seems to be limited…
WISHY
  • 11,067
  • 25
  • 105
  • 197
0
votes
0 answers

Can we use ContentObserver to observe database field changes? (Not insertion and deletion)

Here is my situation. I want to know if any SMS in our device has changed from unread to read. So I am using this ContentObserver to observe DB…
Codevalley
  • 4,593
  • 7
  • 42
  • 56
0
votes
1 answer

ContentObserver onChange() on Android 2.x not get called

I have a ContentObserver which I have tested on android 4.x and it worked well. But when I tried it on android 2.x it doesn't work. mContentObserver = new ContentObserver(new Handler()) { @Override public void…
Roman Nazarevych
  • 7,513
  • 4
  • 62
  • 67
0
votes
1 answer

Can't Unregister a ContentObserver

So, This is the Code im using in a Service : The Service Start & Run this Code : SmsObserver smsSentObserver = new SmsObserver(new Handler(), this); this.getContentResolver().registerContentObserver(Uri.parse("content://sms"), true, …
user2531436
0
votes
1 answer

how to listen to user camera event all the time

I have been writing a Dropbox like android app, which automatically upload photos to the server. When user take photos by camera and save them on SD Card, it will be noticed to upload these photos. I started a service to ensure long time listening,…
Logan Guo
  • 865
  • 4
  • 17
  • 35