A Provider is implemented in application and application updates provider data and triggers a remote service which queries the provider to retrieve the stored values.The appli
TL;DR
Use unstable ContentProviderClient.
Here is explanation from other author: https://stackoverflow.com/a/33562256/87383
LONG READ
Faced the same issue and resolved (workaround) it next way:
First of all you should understand the difference between ContentResolver.registerContentObserver and ContentResolver.query
So, ContentResolver.registerContentObserver simply connects your local ContentObserver instance with ContentService. It's achieved by creating a "bridge" using ContentObserver.Transport class instance (which is basically a binder) and passing it to the ContentService. See ContentObserver.getContentObserver()
Why it's important ? Because those observers are not managed (registered) by ActivityManagerService.
So, what's special about ContentResolver.query method ? To answer this question we have to look at ContentProviderClient. Because actual queries are performed through ContentProviderClient instances which are responsible for contacting with remote ContentProvider.
And there are two "types" of ContentProviderClient - stable and unstable. Unstable clients are managed by your application. But stable one is managed by Android for you so when application is stopped, ActivityManager knows that it's time to kill all clients.
See this commit for more details on unstable content provider clients: https://android.googlesource.com/platform/frameworks/base/+/6ae8d1821822296df0606c9cd1c46708cc21cb58