13

Background: I have an app with notifications and I want to support LED notifications (and it's working perfectly). In my preferences, I allow the user to customize the LED notifications.

Problem: I don't want to show the LED customization options if the device doesn't support them because it can possibly confuse the user (If all you've had were cheap Androids, you have no idea what LED notification is). Is there an API that I can use to detect if the device supports it?

if there is an 'old' and a 'new' way, I'd probably prefer the old way as my lowest supported API level is 4.

Thanks

LED notification: If enabled, your phone's LED will blink for notifications when your display is off.

copolii
  • 13,331
  • 9
  • 46
  • 76
  • I know that this post is so old but i need to know, if you can explain me, how can i do what you have done with the customization of the led in preferences. Have you got a part of code to show me? I have to do the same thing but i don't know how. Thanks – David_D Jul 10 '13 at 14:30
  • 1
    I can't show you any code, since the project wasn't my IP and neither open source. What I can do, however, is tell you what I did. I added the customizations to my preferences screen and when the user checked the checkbox to override the LED color, I presented a dialog stating that not all makes and/or models have notification LEDs or support colors. The user had to press OK on the dialog. I used the standard 'color picker wheel' model for the color chooser (the code is easy to find and many variations of it exist). I hope this helps. – copolii Jul 12 '13 at 07:53
  • Ok thanks, because i want simply that the user can decide the led color from radio buttons in the preferences screen depending on the battery level..for example: if the battery level is 80% the led could be red,or blue..depends from user. Understand? – David_D Jul 12 '13 at 08:06
  • 1
    Yeah, so your case is simpler than mine, but without a proper API you'll have to warn the user somehow that this setting may not actually work because of their device limitations. – copolii Jul 12 '13 at 09:09

1 Answers1

10

Is there an API that I can use to detect if the device supports it?

Alas, no, there is no API for this.

CommonsWare
  • 910,778
  • 176
  • 2,215
  • 2,253
  • 2
    feature request for an API to detect this: http://code.google.com/p/android/issues/detail?id=38481 – larham1 Oct 14 '12 at 19:36