3

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.

1 Answers1

0

Apps are not exactly allowed to wake up device programmaticaly or use a camera in background just like that (it would be a little bit creepy if your phone could take photos of you without any warning. There are hacks but we don't want to do this). Yet:

You can give your app administration privilages, and in such case anything is possible. Waking up your device, shutting it off etc.

https://developer.android.com/guide/topics/admin/device-admin.html

how to make my application device administrator in android?

Hope it helps

muminers
  • 1,190
  • 10
  • 19
  • Thanks muminers I was not aware of app administration previlages.i will try it. Also as written in my question am little curious to know how this feature works in existing apps. – master sHifU The student Mar 10 '18 at 04:38