5

I created a Flashlight app a while back before Android 5.0 was released.

I recently bought a Nexus 6 and the app does not crash but the LED flashlight won't turn on.

After searching around, I believe it is because it is manufactured by Motorola and they don't seem to support Camera.Parameters.FLASH_MODE_TORCH.

I have found several solutions online but none of them seem to be very viable.

Android Lollipop now has a native flashlight capability.
I have been looking through the source code trying to find it but can't seem to.

Does anyone know where in the Android 5.1 source code I can find how Android controls the camera LED for the flashlight?
Or how do they do it?

Mat
  • 202,337
  • 40
  • 393
  • 406
Trevor M
  • 191
  • 1
  • 6
  • Can anybody help me with this please? Thanks – Trevor M Apr 25 '15 at 06:02
  • I fixed the problem getting the LED to turn on on the Nexus 6. It seems obvious but I had to add Camera.setPreviewTexture before Camera.startPreview(). On previous phones I tested this wasn't required although the documentation says it is. I would still like to know how Android toggle the LED for their flashlight so I know how to do it with the new API since Camera is now deprecated (although still functioning) Thanks – Trevor M Apr 28 '15 at 20:39

0 Answers0