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
4
votes
2 answers

how content observer works on deleted files?

I am new to Android development , I am having trouble in tracking the deleted files like audio, video, images etc. I want to get all details of a deleted file and later I want to move deleted files in a separate folder.
4
votes
3 answers

How to register ContentObserver for media volume change?

I encountered a problem when I wanted to implement volume change detection. As the change detection has to be detected in the background via Service, I can not intercept volume key presses. I've tried ContentObserver to listen for volume settings…
4
votes
2 answers

Getting what has changed in ContentObserver

I want to know if the volume has changed. Reading other post I found this code to register a ContentObserver and get an event when something changes. My problem is that I don't know how to know what has changed. I mean, I get an OnReceive() but how…
Ton
  • 9,235
  • 15
  • 59
  • 103
4
votes
1 answer

ContentObserver vs. BroadCastReceiver : Battery Usage, Ram, CPU?

Since there is such a needed concern for an application's battery usage, ram and cpu usage, what is the expense of multiple contentobservers vs. multiple broadcastreceivers? Example 1: A service running with START_STICKY using 5 contentobservers …
ThumbsDP
  • 543
  • 6
  • 18
4
votes
1 answer

Content observer is being called even if the Contacts are not changed

I am facing a problem that is strange, i am using the ContentObserverto catch the changes in the contacts, but the problem is that the onchange() method is called even if i am not making any changes. Here is my code…
AnasBakez
  • 1,230
  • 4
  • 20
  • 36
4
votes
1 answer

How can I get an outgoing mms's address in android

I've spent 5 days trying out different things and lots of googling with no luck I have a broadcast receiver to monitor and backup incoming mms & sms. The sms - outgoing and incoming is easy no problem. MMS however... I have a broadcast receiver for…
jitcoder
  • 41
  • 1
  • 2
3
votes
0 answers

HowTo Sqlite-ContentObserver

I'm writing an android application, which main screen is based on a TabHost. Each Tab holds data selections from a sqlite database. Because in many different activities this data could be accessed and changed, I would like to develop a sqlite…
Phidelux
  • 2,043
  • 1
  • 32
  • 50
3
votes
2 answers

How to get URI of inserted row in my content observer?

In my application, I am inserting values in database from a different class which gives me id of inserted row. I have registered an observer of it in my UI and whenever any row is inserted, my UI content observer will get called. Both the classes…
AndroDev
  • 3,236
  • 8
  • 35
  • 49
3
votes
0 answers

how to use ContentObserver..?

I'm very new to this stuff and could't find an appropriate answer. I did something by myself, i don't know to what extent i'm rite. and its not working. package com.aqui.observer; import android.app.Activity; import android.os.Bundle; import…
ngesh
  • 13,398
  • 4
  • 44
  • 60
3
votes
2 answers

Content Observer changes

If I register a content observer on say the calendar database is there a way to get exactly what changed in the database when an event gets edited?
tyczj
  • 71,600
  • 54
  • 194
  • 296
3
votes
0 answers

Register contentObserver for Battery optimization changes

Since it's not possible to use the infamous action Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS to disable battery optimization in order to avoid sending the user to the settings screen to do so manually, I've tried to register an observer…
Lior Iluz
  • 26,213
  • 16
  • 65
  • 114
3
votes
1 answer

Call end listener in Android

I am developing an application in which I am storing call log details from CallLog provider. Android stores call logs in a database and I am copying new rows from that database. Now I want to copy call details when the user ends a call. For that I…
Dharmendra
  • 33,296
  • 22
  • 86
  • 129
3
votes
1 answer

get SMS number at outgoing time by contentObserver

this is the code that i have try to get sms number when i send sms from default emulator, but it not work. just check out and tell me about that Thanx package com.SMSOberver5; import android.app.Activity; import…
3
votes
1 answer

How whatsapp is syncing contacts instantly after updating

Can anyone help me out in understanding, How WhatsApp and imo apps are syncing contacts immediately after add/delete/updating contact. I have tried following method: Tried to register ContentObserver in service so that we can get contact which is…
3
votes
1 answer

Detect if an android contact has been deleted

I am trying to maintain a contact database and get a callback for Add/Update/Delete as soon as something changes in the URI. I have written a ContentObserver to observe on ContactsContract.Contacts.CONTENT_URI on contacts. I get a callback as soon…