Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the use of android.permission.FLASHLIGHT?

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.

like image 569
Partha Roy Avatar asked Jan 31 '18 22:01

Partha Roy


People also ask

What is the need of permission in android?

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.

What is the use of flashlight app?

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.

What does READ_PHONE_STATE permission do?

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] .

What is camera permission in android?

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.


1 Answers

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:

  • Use <uses-permission android:name="android.permission.CAMERA" /> if you want to develop an app that uses camera and flashlight.
  • Use <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?)

like image 199
Arda Çebi Avatar answered Sep 28 '22 04:09

Arda Çebi