3 Replies Latest reply on Jun 10, 2016 5:24 AM by Dan Silva

    Controlling Scanner Indicator LED Bar Programmatically

    Chase Carlile

      I'm programming an app for the MC92N0 handheld, and I have a business requirement to use the indicator bar to alert the user that something has happened on the server that needs attention.  A red flashing light would indicate an urgent issue.  An amber light would be a warning, etc.  Is this possible? 

       

      From what I've found so far, those lights are used for charging status and scanner status (not scanning, successful decode).

       

      I'm currently using the Xamarin component, but I could possibly create a new binding if it's something that's in an excluded namespace.

        • Re: Controlling Scanner Indicator LED Bar Programmatically
          Dan Silva

          You can use the standard Android notification APIs.  Take a look here. 

          android - How to have LED Light Notification? - Stack Overflow

           

          I tried this code, and it does work,  but as mentioned in the post,  it will only light up the LEDs if the screen is off.

           

          private void testNotification() {

            Notification.Builder builder = new Notification.Builder(this);

            builder.setSmallIcon(R.mipmap.ic_launcher)

            .setPriority(Notification.PRIORITY_HIGH)

            .setOngoing(true);

            builder.setLights(0xff00ff00, 300, 100);

            NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

            manager.notify(1, builder.build());

          }

            • Re: Controlling Scanner Indicator LED Bar Programmatically
              Chase Carlile

              Thank you.  I'll play around with that then. I'm assuming the scanner's beeping noise would also be controlled through the Android api?

                • Re: Controlling Scanner Indicator LED Bar Programmatically
                  Dan Silva

                  You can add a sound to your notification. If you add one line as I have done below,  it will play the default notification sound.  If you want that sound to be the scanner beep,  you can go into settings/sound and set the default notification sound to "Decode".

                   

                  private void testNotification() {

                    Notification.Builder builder = new Notification.Builder(this);

                    builder.setSmallIcon(R.mipmap.ic_launcher)

                    .setPriority(Notification.PRIORITY_MAX)

                    .setSound(Settings.System.DEFAULT_NOTIFICATION_URI)

                    .setOngoing(true);

                   

                    builder.setLights(0xff00ff00, 300, 100);

                    NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

                    manager.notify(1, builder.build());

                  }