I have a question about Android ContentObserver operation

I’m using it to detect a user’s capture by pressing the hardware key.

The function does not work on Galaxy S10+ only (onChange is not called)

All the other devices work, but what’s wrong with him?

Capture related to log is as follows.

E/[ScrCap]_RemoteScrollCaptureInterface (18018): isPackageAvailable : not available. e=android.content.pm.PackageManager$NameNotFoundException: com.samsung co., ltd.android.app.scrollcapture

D/[SmartCapture]_SmartCaptureUtils (18080): isNavigationBarMovable Exception: java.lang.NoSuchMethodException: android.view.IWindowManager$Stub$Proxy.isNavBarCan Move]

E/[SmartCapture]_ScrollCaptureUtils (18080): isPackageAvailable : com.samsung co., ltd.android.service.tagService is not available. e=android.content.pmPackageManager$NameNotFoundException: com.samsung co., ltd.android.service.tagservice

Is there a special issue in Galaxy S10+?

MyCode:

if (contentObserver == null)
{
    HandlerThread handlerThread = new HandlerThread("contentobserver"
    handlerThread.start();

    final Handler handler = new Handler(handlerThread.getLooper())
    {
        @Override
        public void handleMessage(Message msg)
        {
            super.handleMessage(msg);
        }
    };

    contentObserver = new ContentObserver(handler)
    {
        @Override
        public boolean deliverSelfNotifications()
        {                    
            return super.deliverSelfNotifications();
        }

        @Override
        public void onChange(boolean selfChange)
        {
            super.onChange(selfChange);
        }

        @Override
        public void onChange(boolean selfChange, Uri uri)
        {
            super.onChange(selfChange, uri);
        }
    };
}

getContentResolver().registerContentObserver(
        MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
        false,
        contentObserver);

Devices : SM-G975N
Android Version : 10

SEO
Thanks for writing such a nice post. Will definitely share this to reach more people