如何禁用麦克风、摄像头和任何其他工具
我在这里想要实现的是,当我的应用程序启动时,我想禁用 Wi-Fi、相机、麦克风和手机上所有可能的通信工具。
我得到了禁用 wifi 的代码,效果很好 http://androidsnips. blogspot.com/2010/09/turn-off-on-wifi-in-android-using-code.html
另一个用于禁用蓝牙 如何在 android 中以编程方式启用/禁用蓝牙
我不是获取与相机、麦克风或任何可能的东西相关的任何东西。
我希望有人可以提供帮助:)
提前非常感谢。
What I am trying to achieve over here is, I want to disable wi-fi, camera, mic and every possible tool of communication on the phone when my app gets launched.
I got code for disabling wifi, which works good
http://androidsnips.blogspot.com/2010/09/turn-off-on-wifi-in-android-using-code.html
The other one is for disabling bluetooth
How to enable/disable bluetooth programmatically in android
I am not getting anything related to camera, mic or any possible stuff.
I hope someone can help :)
Thanks very much in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您第一次访问它时,Camera 类会锁定到您的进程,并且有方法 lock() 和unlock() - 这意味着当您的应用程序锁定相机时,没有其他进程可以使用该设备,我猜。我怀疑是否有办法摆脱麦克风输入,因为如果您锁定了该设备,您可能会干扰通话。
The Camera class comes locked to your process when you access it for the first time, and there are methods lock() and unlock() - so that means that no other process could use that device while your app has the camera locked, I guess. I doubt there's a way of getting rid of microphone input due to the ability for you to interfere with calls if you had that device locked.
我已经找到了禁用相机的方法。
从2.2开始,我们可以杀死进程(不推荐,但我别无选择),所以我所做的是,当我的条件= true时,我杀死进程。
其他棘手的事情是,当你的条件= true时,传递一个回家并完成活动的意图,这对我来说也很有效。
I have got work around for disabling camera.
From 2.2, we can kill the process (not recommended, but I had no choice), so what I did was, when my condition = true, I kill the process.
Other tricky thing would be, when your condition = true, pass an intent to go to HOME and finish the activity, this worked well too for me.