Thursday, May 5, 2011

Is there a way to raise the backlight on an Android device through the official API?

What I've read seems to indicate that the only way to do it is to use unofficial APIs that are being locked down in Cupcake (1.5). Is this true?

From stackoverflow
  • It looks like the answer is "not until cupcake".

    From Android Developers Blog: Future-Proofing Your Apps:

    Technique to Avoid, #1: Using Internal APIs

    Even though we've always strongly advised against doing so, some developers have chosen to use unsupported or internal APIs. For instance, many developers are using the internal brightness control and bluetooth toggle APIs that were present in 1.0 and 1.1. A bug -- which is now fixed in Android 1.5 -- allowed apps to use those APIs without requesting permission. As a result, apps that use those APIs will break on 1.5. There are other changes to unsupported APIs in 1.5 besides these, so if you've used internal APIs in your apps, you need to update your apps to stop doing so. Even if they don't break on Android 1.5, there's a good chance they will on some later version. (There's some good news, though: because "flashlight" apps are so popular, we've added the "screenBrightness" field on the WindowManager.LayoutParams class just for that use case.)

    Osseta : actually, you seem to have posted the solution. In you own quote "There's some good news, though: because "flashlight" apps are so popular, we've added the "screenBrightness" field on the WindowManager.LayoutParams class just for that use case.)"
    fiXedd : I know... I stumbled upon it so decided to answer my own question. I also intentionally bolded the relevant passages.

0 comments:

Post a Comment