You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Joe Bowser (Commented) (JIRA)" <ji...@apache.org> on 2012/02/08 01:40:59 UTC

[jira] [Commented] (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:comment-tabpanel&focusedCommentId=13203035#comment-13203035 ] 

Joe Bowser commented on CB-173:
-------------------------------

Upped this to 1.5, since it is still broken in 1.4.1
                
> 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.5.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