private class RatedCallsContentObserver extends ContentObserver {
Handler mHandler;
public RatedCallsContentObserver(Handler h) {
super(h);
mHandler = h;
}
@Override
public boolean deliverSelfNotifications() {
return true;
}
@Override
public void onChange(boolean selfChange) {
//here is where you handle the call log change
//it may be a good idea to ensure that the call log application is already running before bringing your app to the foreground
//to ensure it is displayed on top of the call log app
super.onChange(selfChange);
}
}
//later in the Service, attach the appropriate content URI to an instance of our observer
this.getApplicationContext().getContentResolver().registerContentObserver(android.provider.CallLog.Calls.CONTENT_URI, true, new RatedCallsContentObserver(internalHandler));