I want to capture image automatically by using either front or rear camera from an android device when screen is locked and someone try to unlock it. I checked it is possible in Android and some application is available in Market. Please help.
相关问题
- 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
Generally speaking, you have two subproblems:
1) Detect when device is unlocked
As I understand it's reasonably straight forward.
All you need is to have BroadcaseReceiver subscribed to this action (http://developer.android.com/reference/android/content/Intent.html#ACTION_USER_PRESENT).
You read more about this here:
Display screen/activity on Unlock event?
http://funwithdc.wordpress.com/2012/02/12/the-problem-with-androids-action_user_present-intent/
Why is my BroadcastReceiver receiving ACTION_USER_PRESENT twice?
2) Take a picture from bakground
I am not 100% sure whether it's possible or whether it works on all devices. As I know Camera requires to have some preview. However, as I understand it could be invisible preview.
Generally speaking, you want to take a picture either from broadcastreceiver or if you will have problem with that, just create additional service, trigger it from broadcast receiver and take a pictures from there.
Take a look at these questions (they show samples how to do invisible preview):
Taking picture from camera without preview
How to use Camera to take picture in a background Service on Android?
Combining these two things should give you what you want.
You can override the lockscreen to be your app, and then you can capture images like the rest of the app (google can help you with that).