I want to enable/disable camera programmatically in my application.
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
Yes you can disable or enable camera but your app must device admin enabled.Following enables or disable camera:-
The OP is asking for any ideas, I got one idea and it could possibly work even without using the API provided by ICS.
for lower API version than ICS, you can Start a service that will lock the Camera when the screen is On and Release it when the Screen is Off. This is to minimize the usage of battery.
Since, only one process can use the Camera at a time, other applications like the Camera App will not be able to use the Camera.
The challenge now is how to ensure that the Service Hogging the Camera is always Running and prevent it from being uninstalled by the user.
Well, just a thought ;)
You cannot do this from a regular app. You can do it from a device administrator, but the user has to explicitly enable it and it is only available on ICS. Here's the reference: http://developer.android.com/guide/topics/admin/device-admin.html
Yes, you can use DeviceAdministration class and control the camera source(block and unblock). This is a repo with an example.