I'm developing a flashlight app using Camera 2 API. Every thing works fine.
While developing the app I came across quite a few tutorials and even posts from stack-overflow where people have used "android.permission.FLASHLIGHT" permission.
I tried to search official documentation for "android.permission.FLASHLIGHT" (in developer.android.com) but couldn't find any.
I just what to know what is permission is and is it required for turning torch mode on. If yes, why there is no official documentation and why is my app(targets API >=21) working without this permission?
Note: I tested my app in android 5, 6, 7, 8 and it works fine, except in Nokia 6 and Xiaomi redimi note.
Android app permissions can give apps control of your phone and access to your camera, microphone, private messages, conversations, photos, and more. App permission requests pop up the first time an app needs access to sensitive hardware or data on your phone or tablet and are usually privacy-related.
Flashlight app is a free, intuitive and easy to use torch app for Android which uses the built-in camera LED flash and provides the brightest light possible. If your device does not have a Camera flash (or if it's broken, or glitching out), you can use the white screen mode.
READ_PHONE_STATE is one of the Android permissions categorized as dangerous. This is because it “allows read only access to phone state, including the phone number of the device, current cellular network information, the status of any ongoing calls, and a list of any Phone Accounts registered on the device” [2] .
For location, camera, and microphone permissions, you may be able to choose: All the time (Location only): The app can use the permission at any time, even when you're not using the app. Allow only while using the app: The app can use the permission only when you're using that app.
The <uses-permission android:name="android.permission.CAMERA" />
already has the option to use the flashlight.
But <uses-permission android:name="android.permission.FLASHLIGHT" />
only allows the user to use the flashlight without activating the camera hardware.
This means:
<uses-permission android:name="android.permission.CAMERA" />
if you want to develop an app that uses camera and flashlight.<uses-permission android:name="android.permission.FLASHLIGHT" />
if you want to develop an app that ONLY uses flashlight.But, some users have seen crashes using the <uses-permission android:name="android.permission.FLASHLIGHT" />
permission in their apps. So, you can use both of them to make sure your app is working without crashes (For example: Which permissions are required for Flashlight?)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With