You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Simon MacDonald (Updated) (JIRA)" <ji...@apache.org> on 2012/01/13 15:49:40 UTC

[jira] [Updated] (CB-173) Battery events not working properly on HTC Inspire running 2.2

     [ https://issues.apache.org/jira/browse/CB-173?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simon MacDonald updated CB-173:
-------------------------------

    Fix Version/s: 1.4.0
         Assignee: Steve Gill

This is actually a packaging problem. The "plugins.xml" file that is packaged up as part of the download from phonegap.com does not included the line for the Battery plugin. I'm assigning it to Steve for the 1.4 release.
                
> Battery events not working properly on HTC Inspire running 2.2
> --------------------------------------------------------------
>
>                 Key: CB-173
>                 URL: https://issues.apache.org/jira/browse/CB-173
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: Android
>    Affects Versions: 1.3.0
>         Environment: HTC Inspire, Android 2.2
>            Reporter: Filip Maj
>            Assignee: Steve Gill
>             Fix For: 1.4.0
>
>
> Originally reported by Ray Camden:
> Trying to get a very simple battery status app working. None of my events ever fire. According to the docs, batterystatus should fire when plugging/unplugging a device, but that doesn't trigger it either. Any ideas? HTC Inspire, Android 2.2 SDK. Code below. Note the alert in my battery status callback. I did that in case I screwed up something simple in drawStatus.
> <!DOCTYPE HTML>
> <html>
>   <head>
>     <meta name="viewport" content="width=320; user-scalable=no" />
>     <meta http-equiv="Content-type" content="text/html; charset=utf-8">
>     <title>Minimal AppLaud App</title>
> 	  <script type="text/javascript" charset="utf-8" src="phonegap-1.3.0.js"></script>
> 	  <script type="text/javascript" charset="utf-8">
> 		var status;
> 		var drawStatus = function(info){
> 			var s = "<p><b>Battery Status</b><br/>";
> 			s += "Level is "+info.level + "<br/>";
> 			s += "Plugged in is "+info.isPlugged;
> 			s += "</p>";
> 			status.innerHTML = s;
> 		};
> 				
>       	var battCrit = function(info) {
> 			navigator.notification.alert("Your battery is SUPER low!");
> 			drawStatus(info);
> 		};
>       	var battLow = function(info) {
> 			navigator.notification.alert("Your battery is low!");
> 			drawStatus(info);
> 		};
>       	var battStat = function(info) {
> 			alert('test');
> 			drawStatus(info);
> 		};
> 	  
>         var onDeviceReady = function() {
> 			//listen for battery crit
> 			window.addEventListener("batterycritical", battCrit, false);
> 			window.addEventListener("batterylow", battLow, false);
> 			window.addEventListener("batterystatus", battStat, false);
> 			alert("registered...");
>         };
>         function init() {
>             document.addEventListener("deviceready", onDeviceReady, true);
> 			status = document.getElementById("status");
>         }   
> 	  </script>  
>   </head>
>   <body onload="init();">
>     <h2>Battery Tester</h2>
> 	<div id="status"></div>
>   </body>
> </html>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira