9 Replies Latest reply on Mar 27, 2013 9:54 AM by Peter Arcuri

    problem displaying battery in native apps

    Luca Priano

      Hi guys,

       

      I tried to use theese meta tags to display the battery module in my native Rho app for Android but it doesn't appear !!!   

      I've inserted them in my layout.erb file (very simple) which I attach

       

           <META HTTP-Equiv="battery" Content="visibility:visible">

           <META HTTP-Equiv="battery" Content="Left:50">

           <META HTTP-Equiv="battery" Content="Top:50">

           <META HTTP-Equiv="battery" Content="Layout:Left">

           <META HTTP-Equiv="battery" Content="Color:#FF0000">       

       

      I've tried use the same tags also in a html page deployed on a web server using Rho Elements Runtime on my device, and I see the battery module without any issue.

       

      What could be the problem?

       

      Thanks a lot for any hint!!!

        • Re: problem displaying battery in native apps
          Pietro Francesco Maggi

          Hi Luca,

          the RhoElements metatags are supported only by the Motorola WebKit Browser, available on Windows Mobile/Windows CE and Android.

           

          To enable it, you need to have in your build.yml file the options:

           

          app_type: "rhoelements"

          capabilities:

            - motorola_browser

           

          let me know if this solves the problem for you

           

          Pietro Maggi

          EIA RhoMobile Technical Architect

          1 of 1 people found this helpful
            • Re: problem displaying battery in native apps
              Luca Priano

              Thanks Pietro, your answer has been very useful, but I've theese two strange behaviours:

               

              • the battery is always full-colored, such as it was completly charged (it isn't), and when I connect the charger at the smartphone the battery doesn't change its aspect to represent it is charging. These issues don't appear if I use an html page deployed on a web server using Rho Elements Runtime...why is there this different behaviour?!?


              • Adding the capability and the apptype you suggested to me all layouts elements make smaller (buttons, etc), why ?!?!

               

              Thanks a lot,

              Luca

                • Re: problem displaying battery in native apps
                  Derek Warren

                  What is the OS of the smartphone you are referencing?

                   

                  Also can you include your build.yml file that has the issues you are talking about in the first bullet?

                   

                  My intuition believes you might be useing the Motorola Webkit browser for some devices and the native browser for others (should you be using an iOS device).

                    • Re: problem displaying battery in native apps
                      Luca Priano

                      I'm using Android OS. Anyway I've just discovered that the problem concerning the right battery module displaying is due to the color I setted for it : #FFFFFF 

                      Using others colors it's all ok!!!!

                       

                      Is this problem only releated with Android SO? I've also found it in this discussion https://developer.motorolasolutions.com/message/2996#2996

                      As soon as I possible I try with a Windows Mobile device.

                       

                      Regarding the second bullet (adding app_type: "rhoelements" capabilities:  - motorola_browser  my native web app layout components make smaller ), any suggestions?!?! I'm developing the interface using jQuery Mobile, is it possible that this app_type and capability modify css???

                       

                      Thanks,

                      Luca

                        • Re: problem displaying battery in native apps
                          Peter Arcuri

                          Luca, you want to use Ruby battery api when using the Rhodes framework (native app). The Meta tags you used are for HTML/Javascipt web apps, hence the positive results when running it with the RhoElements shared runtime.

                           

                          When working with the Rhodes framework (native app) you may want to use te Battery Ruby Object Syntax: At least for version 2.2 and under.

                          BatteryRubyObject.png

                          http://docs.rhomobile.com/rhoelements/battery/

                            • Re: problem displaying battery in native apps
                              Luca Priano

                              Hi Peter,

                               

                              I'm using meta tags in an html page (layout.erb) of my native app, infact I don't have any problems...only if I try to set white color for the battery module, the battery always remains full-colored, otherwise no issues!

                               

                              The only aspect I don't understand is that adding

                               

                              app_type: "rhoelements"

                              capabilities: 

                                   - motorola_browser

                               

                              in my build.xml file, layout dimensions change, they make smaller (buttons, labels, etc). The page layout (layout.erb) is written with jquery mobile...Is it possible that inserting rhoelements app_type and motorola_browser capability, any css is import into app?

                               

                              Thanks a lot for any clue!

                                • Re: problem displaying battery in native apps
                                  Peter Arcuri

                                  Luca, if you're confortable with using an undocumented feature then that's fine.

                                   

                                  Regarding use of motorola_browser; just like any other browsers, rendering of objects may vary from one rendering-engine to another. If objects, in this case, appear smaller than expected then perhaps use of the Zoom Module would be helpful here.

                                   

                                  http://docs.rhomobile.com/rhoelements/zoom

                                    • Re: problem displaying battery in native apps
                                      Luca Priano

                                      Peter, I think the battery module problem I've highlighted is due to a bug, not because I'm using an undocumented feature. It happens also in an HTML/Javascipt web apps. Try this simple page yourself with RhoElements Runtime:

                                       

                                      <HTML>

                                           <HEAD>

                                       

                                                <META HTTP-Equiv="battery" Content="visibility:visible">

                                                <META HTTP-Equiv="battery" Content="Left:100">

                                                <META HTTP-Equiv="battery" Content="Top:100">

                                                <META HTTP-Equiv="battery" Content="Layout:Left">

                                                <META HTTP-Equiv="battery" Content="Color:#FFFFFF"  --> the problem is white color: if you change the color, the battery module is right

                                       

                                                <meta http-equiv="quitbutton" content="visibility:visible;" />

                                       

                                            </HEAD>

                                       

                                           <BODY bgColor="black">

                                            </BODY>

                                      </HTML>

                                        • Re: problem displaying battery in native apps
                                          Peter Arcuri

                                          Luca, you're correct... I finally got a chance to test it and it clearly exhibits an issue when using white as its color. However, not sure if it's a bug. Since the background of the battery indicator is white by default so if using white in the color setting it would simply show white across. The obvious suggestion here would be to use any color except for white, at least until if or when a "background color" attribute is introducted to the Battery API.