How to log the history of opening camera in Android - android

I am Developing an android application that should record the change state of the camera device in my phone in which every time I open the camera from any other application in my phone this application should save that application "X" open the camera at time "Y" and so on.
I have reached in my code to record the time that the camera was opened and close but I could not figure out how to discover the program name who has held the camera.

You could check the job queue from your BroadcastReceiver and see what is the current app.
related topic

Related

How to capture an Image and record a voice, through a service, even if the device is locked?

I am working on my app and i am developing android anti lost app. So how can i make a service that will capture image or record voice even when device is locked ,I have figured out how to trigger that service.
But how to write code that will do the job even if device is locked?
For making an anti lost app the service must run the whole time . I don't think that lock screen will affect the workings once the service is on still you should try using PowerManager class with permission android.permission.WAKE_LOCK.....
refer to https://developer.android.com/reference/android/os/PowerManager for more details
for camera you can refer to https://www.javatpoint.com/android-camera-tutorial
for voice recorder you can refer to https://www.tutorialspoint.com/android/android_audio_capture.htm

How do I notified when camera is used or opened by any other application

I want to get notified whenever any other application opened or accessed camera. I already know that I can check Camera.open() and its exception. but for that I have to check every time using service but it drain battery so I want whenever opened camera just notified me and get its package name. I already read these.
How to find whether the camera is in use?
How to check if camera is opened by any application
You can do it using callbacks provided by the API of Camera2.
In your CameraManagerobject you can attach a CameraManager.AvailabilityCallback which will notice you when the camera object is being used or not.
About AvailabilityCallback:
A callback for camera devices becoming available or unavailable to
open.
Cameras become available when they are no longer in use, or when a new
removable camera is connected. They become unavailable when some
application or service starts using a camera, or when a removable
camera is disconnected.
You can research more information about it in the official documentation

Get noticed when other app tries to access camera on Android

I am working on the app that uses camera and mic in background mode. Obviously, when my app is active other camera apps (like Camera) will not work as the camera is held by my app.
Is there any way to get notified when the other app tries to open camera (if the camera is held by my app)?
I want my app to show some popup or notification when any other app tries to get camera (I think it will be more user-friendly to show some notice then to rely on other app's error messages)

Launch Google Camera or Default Camera over lock screen

I would like to learn more about how the camera can launch over the secure lock-screen (PIN).
My goal is to have a user select either their default camera app or another camera app (like Google Camera). I would then like to invoke or launch the camera without the user being required to enter their pin code, etc.
I have read that this is possible starting with Android 4.2.
Here is the post:
Launch camera activity over lock screen
Currently in my test build the camera app launches, but the user my first unlock the device.
Any help is appreciated.
Thank you.

Kill Camera App Programmatically on Android

I am currently looking into creating a location aware security app whereby the camera is disabled if the phone moves into a designated location. I am now able to disable and enable the camera using the Device Administrator class and calling setCameraDisabled to disable the camera. However, the problem I am encountering now is that if the setCameraDisable method is called when the camera is running, the camera app doesn't close. The camera app would only be disabled on the next launch. As such I am wondering is there is a way for me to kill the camera process before calling the setCameraDisabled method. Thanks in advance.
Try this
android.os.Process.killProcess(android.os.Process.myPid());

Categories

Resources