1 Reply Latest reply on Dec 13, 2012 2:08 AM by Benedict Kennedy

    Adding battery level & WiFi signal level indicators, flickers the screen

      Dear Mr. Ben,

       

      We are using following code to add battery level & WiFi signal level indicators on the top right corner of our application -

       

      <!--

      <html>

      <head>

      <script type="text/javascript" src="../src/asl.js"></script>

        <title>Home</title>

        <meta http-equiv="Signal" content="Top:2;left:290; Color:#B1B1B1; Visibility:Visible">

        <link rel="stylesheet" href="style.css" />

        <meta http-equiv="Battery" content="Top:2;left:255;IconPosition:Bottom;Iconposition:right;color:#B1B1B1;visibility:visible">

        <script type="text/javascript" src="js/main.js"></script>

        <script type="text/javascript">

      -->

       

       

      The indicators are working well, but, probably, as we have observed, because of continuous updation of the battery and signal levels, the screen is refreshed after every few seconds and makes the application user feel like flickering of the screen. Can it be controlled, can we stop this flicker or delay it for long? Please advise.

       

      Regards,

       

      RANA

        • Re: Adding battery level & WiFi signal level indicators, flickers the screen
          Benedict Kennedy

          Hi Rana,

           

          Thanks for the report. We would encourage not to put the battery and WiFi signal icons on the screen for the reasons:

          1. The reason you specify above,
          2. As it will use up a lot more battery power as it will do a lot more screen refreshes.
          3. Signal and Wifi are available in the settings page

           

          There are workarounds to this:

          1. Create your own signal/battery icons by listening to the signal.signalEvent and battery.batteryEvent and then using the JavaScript callbacks to paint your icon if and only if the icon needs to change. To place it ontop of the title bar you will need to set the CSS property "z-index" to a value of 10000 or higher.
          2. Or listen to the shell events onSignalLost, onSignalRestored and onLowBattery. Hopefully these will negate the need for indicators and they are less battery intensive than using battery and signal events as they don't poll for data.

           

          I have created a bug report for the default indicators regarding needless updates, but unfortunately the fix wont be available for a while.

           

          Regards,

          Ben