Search code examples
androidandroid-intentandroid-cameraandroid-camera-intentandroid-camerax

Can I read the opened camera intent from my so


I built a face detection app that is working fine, the user can:

  • open the camera intent
  • take a picture

    then it will screen this picture and tell if there is a face in it or no.

My idea is I don't need the user to open the camera from my app I need the user to open the camera app in Android as normal, and then I will be working in the background reading the picture had been taken by his camera, analyse it and till by a toast if a face had been detected or no.

Not sure about if my application can detect if the camera had been opened or no and if opened can detect if phot had been taken or no, and if yes, can I read this image or no!! If yes, how?!


Solution

  • Not sure about if my application can detect if the camera had been opened or no

    Not really. You cannot detect what apps are in the foreground on modern versions of Android, for privacy and security reasons. And, even if you could, there are hundreds (perhaps thousands) of camera apps. You would have no reliable way of knowing whether any given app is really a camera app.

    if opened can detect if phot had been taken or no

    Not really. There is no requirement for a camera app to put its images anywhere that your app can access it. And, there is no reliable way to know whether any given file is a photo or not.