I am making an MDM app in which I have to block screen shot across all apps in device. I know using
getWindow().setFlags(LayoutParams.FLAG_SECURE,LayoutParams.FLAG_SECURE)
I can disable screen capture in my apps activities, but I want to disable screen capture in all apps installed into device. Previously I was using File observer to block screen capture, it was detecting if any image has been added to Screenshot folder, it was deleting that image. But from Android M,they are not allowing file observer. I have search alot but didn't get any solution. But many android apps like quick heal's seqrite MDM is preventing screen capture in android M too, so there must be some way.
I found api setScreenCaptureDisabled in DevicePolicyManger class which can disable screen capture, but it can be called by device owner apps only.
Please help me if any one know the way to block screen capture.