Am using code like this for using camera app:
androidmanifest.xml:
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
StartCam.java
Intent ci = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
ci.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
.....
this.startActivity(ci);
There is a feature in moto phone when you double press power key cam app is opened and can be used even when the phone is locked.I want to implement similar feature.I want to know how this feature is implemented are they also using intent to call cam app even when phone is locked.?How the cam app is displayed and enabled for use when screen is locked?
In my app when the screen is not locked cam app will open and can be used.When screen is locked cam app will open but to see if cam app is open and to use it i need to unlock the screen.
答案 0 :(得分:0)
应用程序并不是完全允许在程序设备中唤醒设备或在背景中使用相机(如果您的手机可以在没有任何警告的情况下拍摄您的照片,那将会有点令人毛骨悚然。有黑客但我们没有&#39 ; t想要这样做)。然而:
您可以为您的应用管理提供权限,在这种情况下,任何事情都是可能的。唤醒你的设备,关闭它等等。
https://developer.android.com/guide/topics/admin/device-admin.html
how to make my application device administrator in android?
希望有所帮助