You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Muhammad Siddiq Akbar (Created) (JIRA)" <ji...@apache.org> on 2012/01/19 11:32:41 UTC

[jira] [Created] (CB-186) batterystatus event does not fire on iPod

batterystatus event does not fire on iPod
-----------------------------------------

                 Key: CB-186
                 URL: https://issues.apache.org/jira/browse/CB-186
             Project: Apache Callback
          Issue Type: Bug
          Components: iOS
    Affects Versions: 1.3.0
         Environment: build.phonegap.com
            Reporter: Muhammad Siddiq Akbar
            Assignee: Shazron Abdullah
            Priority: Blocker


This is my index.html:

<!DOCTYPE html>
<html>
  <head>
    <title>PhoneGap Device Ready Example</title>

    <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
    <script type="text/javascript" charset="utf-8">

    // Call onDeviceReady when PhoneGap is loaded.
    //
    // At this point, the document has loaded but phonegap.js has not.
    // When PhoneGap is loaded and talking with the native device,
    // it will call the event `deviceready`.
    // 
    function onLoad() {
        document.addEventListener("deviceready", onDeviceReady, false);
    }

    // PhoneGap is loaded and it is now safe to make calls PhoneGap methods
    //
    function onDeviceReady() {
        window.addEventListener("batterystatus", onBatteryStatus, false);
    }

    // Handle the batterystatus event
    //
    function onBatteryStatus(info) {
        console.log("Level: " + info.level + " isPlugged: " + info.isPlugged); 
    }

    </script>
  </head>
  <body onload="onLoad()">
  </body>
</html>



This is my config.xml:

<?xml version="1.0" encoding="UTF-8" ?>
    <widget xmlns = "http://www.w3.org/ns/widgets"
        xmlns:gap = "http://phonegap.com/ns/1.0"
        id        = "com.phonegap.example"
        versionCode="10" <!-- optional: Android only -->
        version   = "1.0.0">

    <name>Accurate Battery Status</name>

    <description>
        An example for phonegap build docs. 
    </description>

    <author href="https://build.phonegap.com" email="support@phonegap.com">
        Siddiq 
    </author>

    <feature name="http://api.phonegap.com/1.0/battery"/>
    <feature name="http://api.phonegap.com/1.0/camera"/>
    <feature name="http://api.phonegap.com/1.0/contacts"/>
    <feature name="http://api.phonegap.com/1.0/file"/>
    <feature name="http://api.phonegap.com/1.0/geolocation"/>
    <feature name="http://api.phonegap.com/1.0/media"/>
    <feature name="http://api.phonegap.com/1.0/network"/>
    <feature name="http://api.phonegap.com/1.0/notification"/>

</widget>


--
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

        

[jira] [Commented] (CB-186) batterystatus event does not fire on iPod

Posted by "Muhammad Siddiq Akbar (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-186?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13189713#comment-13189713 ] 

Muhammad Siddiq Akbar commented on CB-186:
------------------------------------------

I am using build.phonegap.com and it requires to include the js as "phonegap.js" without version number. 
But it is using version 1.3.0.

Here is my updated testcase index.html file:



<!DOCTYPE html>
<html>
<head>
<title>PhoneGap Device Ready Example</title>

<script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
<script type="text/javascript" charset="utf-8">

// Call onDeviceReady when PhoneGap is loaded.
//
// At this point, the document has loaded but phonegap.js has not.
// When PhoneGap is loaded and talking with the native device,
// it will call the event `deviceready`.
//
function onLoad() {
    alert('onload called');
    document.addEventListener("deviceready", onDeviceReady, false);
}

// PhoneGap is loaded and it is now safe to make calls PhoneGap methods
//
function onDeviceReady() {
    alert('deviceready called');
    window.addEventListener("batterystatus", onBatteryStatus, false);
}

// Handle the batterystatus event
//
function onBatteryStatus(info) {
    alert('batterystatus called');
    alert(info.level);
    console.log("Level: " + info.level + " isPlugged: " + info.isPlugged);
}

</script>
</head>
<body onload="onLoad()">
</body>
</html>



This shows only first two alerts i.e. 'onload called' and 'deviceready called'. 
But no alert is displayed after that.

I have even tried to unplug and replug the usb sync cable. 
But still shows no further alerts.

Could it be that build.phonegap.com is not packaging it properly with the batterystatus permissions?
                
> batterystatus event does not fire on iPod
> -----------------------------------------
>
>                 Key: CB-186
>                 URL: https://issues.apache.org/jira/browse/CB-186
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 1.3.0
>         Environment: build.phonegap.com
>            Reporter: Muhammad Siddiq Akbar
>            Assignee: Shazron Abdullah
>            Priority: Blocker
>
> This is my index.html:
> <!DOCTYPE html>
> <html>
>   <head>
>     <title>PhoneGap Device Ready Example</title>
>     <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
>     <script type="text/javascript" charset="utf-8">
>     // Call onDeviceReady when PhoneGap is loaded.
>     //
>     // At this point, the document has loaded but phonegap.js has not.
>     // When PhoneGap is loaded and talking with the native device,
>     // it will call the event `deviceready`.
>     // 
>     function onLoad() {
>         document.addEventListener("deviceready", onDeviceReady, false);
>     }
>     // PhoneGap is loaded and it is now safe to make calls PhoneGap methods
>     //
>     function onDeviceReady() {
>         window.addEventListener("batterystatus", onBatteryStatus, false);
>     }
>     // Handle the batterystatus event
>     //
>     function onBatteryStatus(info) {
>         console.log("Level: " + info.level + " isPlugged: " + info.isPlugged); 
>     }
>     </script>
>   </head>
>   <body onload="onLoad()">
>   </body>
> </html>
> This is my config.xml:
> <?xml version="1.0" encoding="UTF-8" ?>
>     <widget xmlns = "http://www.w3.org/ns/widgets"
>         xmlns:gap = "http://phonegap.com/ns/1.0"
>         id        = "com.phonegap.example"
>         versionCode="10" <!-- optional: Android only -->
>         version   = "1.0.0">
>     <name>Accurate Battery Status</name>
>     <description>
>         An example for phonegap build docs. 
>     </description>
>     <author href="https://build.phonegap.com" email="support@phonegap.com">
>         Siddiq 
>     </author>
>     <feature name="http://api.phonegap.com/1.0/battery"/>
>     <feature name="http://api.phonegap.com/1.0/camera"/>
>     <feature name="http://api.phonegap.com/1.0/contacts"/>
>     <feature name="http://api.phonegap.com/1.0/file"/>
>     <feature name="http://api.phonegap.com/1.0/geolocation"/>
>     <feature name="http://api.phonegap.com/1.0/media"/>
>     <feature name="http://api.phonegap.com/1.0/network"/>
>     <feature name="http://api.phonegap.com/1.0/notification"/>
> </widget>

--
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

        

[jira] [Commented] (CB-186) batterystatus event does not fire on iPod

Posted by "Becky Gibson (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-186?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13189275#comment-13189275 ] 

Becky Gibson commented on CB-186:
---------------------------------

Are you sure that the deviceReady event is firing?  How are you testing? The best method would be to attach / detach the power code as that will cause the event to fire immediately.   Also, normally the phonegap.js file contains the version number and yours does not.  However, it seems that you are using phonegap.build service.  I am not familiar with that so perhaps the javascript file name is correct.  You'll have to provide some more details to prove that this is truly a bug.
                
> batterystatus event does not fire on iPod
> -----------------------------------------
>
>                 Key: CB-186
>                 URL: https://issues.apache.org/jira/browse/CB-186
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 1.3.0
>         Environment: build.phonegap.com
>            Reporter: Muhammad Siddiq Akbar
>            Assignee: Shazron Abdullah
>            Priority: Blocker
>
> This is my index.html:
> <!DOCTYPE html>
> <html>
>   <head>
>     <title>PhoneGap Device Ready Example</title>
>     <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
>     <script type="text/javascript" charset="utf-8">
>     // Call onDeviceReady when PhoneGap is loaded.
>     //
>     // At this point, the document has loaded but phonegap.js has not.
>     // When PhoneGap is loaded and talking with the native device,
>     // it will call the event `deviceready`.
>     // 
>     function onLoad() {
>         document.addEventListener("deviceready", onDeviceReady, false);
>     }
>     // PhoneGap is loaded and it is now safe to make calls PhoneGap methods
>     //
>     function onDeviceReady() {
>         window.addEventListener("batterystatus", onBatteryStatus, false);
>     }
>     // Handle the batterystatus event
>     //
>     function onBatteryStatus(info) {
>         console.log("Level: " + info.level + " isPlugged: " + info.isPlugged); 
>     }
>     </script>
>   </head>
>   <body onload="onLoad()">
>   </body>
> </html>
> This is my config.xml:
> <?xml version="1.0" encoding="UTF-8" ?>
>     <widget xmlns = "http://www.w3.org/ns/widgets"
>         xmlns:gap = "http://phonegap.com/ns/1.0"
>         id        = "com.phonegap.example"
>         versionCode="10" <!-- optional: Android only -->
>         version   = "1.0.0">
>     <name>Accurate Battery Status</name>
>     <description>
>         An example for phonegap build docs. 
>     </description>
>     <author href="https://build.phonegap.com" email="support@phonegap.com">
>         Siddiq 
>     </author>
>     <feature name="http://api.phonegap.com/1.0/battery"/>
>     <feature name="http://api.phonegap.com/1.0/camera"/>
>     <feature name="http://api.phonegap.com/1.0/contacts"/>
>     <feature name="http://api.phonegap.com/1.0/file"/>
>     <feature name="http://api.phonegap.com/1.0/geolocation"/>
>     <feature name="http://api.phonegap.com/1.0/media"/>
>     <feature name="http://api.phonegap.com/1.0/network"/>
>     <feature name="http://api.phonegap.com/1.0/notification"/>
> </widget>

--
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

        

[jira] [Commented] (CB-186) batterystatus event does not fire on iPod

Posted by "Shazron Abdullah (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CB-186?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13191787#comment-13191787 ] 

Shazron Abdullah commented on CB-186:
-------------------------------------

build.phonegap.com issues are separate from cordova issues.

I've done tests and this works as expected - you can test this easily by unplugging/plugging in your usb charge cable (when connected to a usb port) to trigger a battery status change.

Note that a battery level change only happens at 5% increments (ie 90, 95, 100, etc).

PGB issues should be filed at http://community.phonegap.com - this could be a case of the PhoneGap.plist not having the battery plugin mapping.

Closing as no repro.

                
> batterystatus event does not fire on iPod
> -----------------------------------------
>
>                 Key: CB-186
>                 URL: https://issues.apache.org/jira/browse/CB-186
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 1.3.0
>         Environment: build.phonegap.com
>            Reporter: Muhammad Siddiq Akbar
>            Assignee: Shazron Abdullah
>            Priority: Blocker
>
> This is my index.html:
> <!DOCTYPE html>
> <html>
>   <head>
>     <title>PhoneGap Device Ready Example</title>
>     <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
>     <script type="text/javascript" charset="utf-8">
>     // Call onDeviceReady when PhoneGap is loaded.
>     //
>     // At this point, the document has loaded but phonegap.js has not.
>     // When PhoneGap is loaded and talking with the native device,
>     // it will call the event `deviceready`.
>     // 
>     function onLoad() {
>         document.addEventListener("deviceready", onDeviceReady, false);
>     }
>     // PhoneGap is loaded and it is now safe to make calls PhoneGap methods
>     //
>     function onDeviceReady() {
>         window.addEventListener("batterystatus", onBatteryStatus, false);
>     }
>     // Handle the batterystatus event
>     //
>     function onBatteryStatus(info) {
>         console.log("Level: " + info.level + " isPlugged: " + info.isPlugged); 
>     }
>     </script>
>   </head>
>   <body onload="onLoad()">
>   </body>
> </html>
> This is my config.xml:
> <?xml version="1.0" encoding="UTF-8" ?>
>     <widget xmlns = "http://www.w3.org/ns/widgets"
>         xmlns:gap = "http://phonegap.com/ns/1.0"
>         id        = "com.phonegap.example"
>         versionCode="10" <!-- optional: Android only -->
>         version   = "1.0.0">
>     <name>Accurate Battery Status</name>
>     <description>
>         An example for phonegap build docs. 
>     </description>
>     <author href="https://build.phonegap.com" email="support@phonegap.com">
>         Siddiq 
>     </author>
>     <feature name="http://api.phonegap.com/1.0/battery"/>
>     <feature name="http://api.phonegap.com/1.0/camera"/>
>     <feature name="http://api.phonegap.com/1.0/contacts"/>
>     <feature name="http://api.phonegap.com/1.0/file"/>
>     <feature name="http://api.phonegap.com/1.0/geolocation"/>
>     <feature name="http://api.phonegap.com/1.0/media"/>
>     <feature name="http://api.phonegap.com/1.0/network"/>
>     <feature name="http://api.phonegap.com/1.0/notification"/>
> </widget>

--
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

        

[jira] [Closed] (CB-186) batterystatus event does not fire on iPod

Posted by "Shazron Abdullah (Closed) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CB-186?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shazron Abdullah closed CB-186.
-------------------------------

    
> batterystatus event does not fire on iPod
> -----------------------------------------
>
>                 Key: CB-186
>                 URL: https://issues.apache.org/jira/browse/CB-186
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 1.3.0
>         Environment: build.phonegap.com
>            Reporter: Muhammad Siddiq Akbar
>            Assignee: Shazron Abdullah
>            Priority: Blocker
>
> This is my index.html:
> <!DOCTYPE html>
> <html>
>   <head>
>     <title>PhoneGap Device Ready Example</title>
>     <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
>     <script type="text/javascript" charset="utf-8">
>     // Call onDeviceReady when PhoneGap is loaded.
>     //
>     // At this point, the document has loaded but phonegap.js has not.
>     // When PhoneGap is loaded and talking with the native device,
>     // it will call the event `deviceready`.
>     // 
>     function onLoad() {
>         document.addEventListener("deviceready", onDeviceReady, false);
>     }
>     // PhoneGap is loaded and it is now safe to make calls PhoneGap methods
>     //
>     function onDeviceReady() {
>         window.addEventListener("batterystatus", onBatteryStatus, false);
>     }
>     // Handle the batterystatus event
>     //
>     function onBatteryStatus(info) {
>         console.log("Level: " + info.level + " isPlugged: " + info.isPlugged); 
>     }
>     </script>
>   </head>
>   <body onload="onLoad()">
>   </body>
> </html>
> This is my config.xml:
> <?xml version="1.0" encoding="UTF-8" ?>
>     <widget xmlns = "http://www.w3.org/ns/widgets"
>         xmlns:gap = "http://phonegap.com/ns/1.0"
>         id        = "com.phonegap.example"
>         versionCode="10" <!-- optional: Android only -->
>         version   = "1.0.0">
>     <name>Accurate Battery Status</name>
>     <description>
>         An example for phonegap build docs. 
>     </description>
>     <author href="https://build.phonegap.com" email="support@phonegap.com">
>         Siddiq 
>     </author>
>     <feature name="http://api.phonegap.com/1.0/battery"/>
>     <feature name="http://api.phonegap.com/1.0/camera"/>
>     <feature name="http://api.phonegap.com/1.0/contacts"/>
>     <feature name="http://api.phonegap.com/1.0/file"/>
>     <feature name="http://api.phonegap.com/1.0/geolocation"/>
>     <feature name="http://api.phonegap.com/1.0/media"/>
>     <feature name="http://api.phonegap.com/1.0/network"/>
>     <feature name="http://api.phonegap.com/1.0/notification"/>
> </widget>

--
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

        

[jira] [Resolved] (CB-186) batterystatus event does not fire on iPod

Posted by "Shazron Abdullah (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CB-186?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Shazron Abdullah resolved CB-186.
---------------------------------

    Resolution: Cannot Reproduce
    
> batterystatus event does not fire on iPod
> -----------------------------------------
>
>                 Key: CB-186
>                 URL: https://issues.apache.org/jira/browse/CB-186
>             Project: Apache Callback
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 1.3.0
>         Environment: build.phonegap.com
>            Reporter: Muhammad Siddiq Akbar
>            Assignee: Shazron Abdullah
>            Priority: Blocker
>
> This is my index.html:
> <!DOCTYPE html>
> <html>
>   <head>
>     <title>PhoneGap Device Ready Example</title>
>     <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
>     <script type="text/javascript" charset="utf-8">
>     // Call onDeviceReady when PhoneGap is loaded.
>     //
>     // At this point, the document has loaded but phonegap.js has not.
>     // When PhoneGap is loaded and talking with the native device,
>     // it will call the event `deviceready`.
>     // 
>     function onLoad() {
>         document.addEventListener("deviceready", onDeviceReady, false);
>     }
>     // PhoneGap is loaded and it is now safe to make calls PhoneGap methods
>     //
>     function onDeviceReady() {
>         window.addEventListener("batterystatus", onBatteryStatus, false);
>     }
>     // Handle the batterystatus event
>     //
>     function onBatteryStatus(info) {
>         console.log("Level: " + info.level + " isPlugged: " + info.isPlugged); 
>     }
>     </script>
>   </head>
>   <body onload="onLoad()">
>   </body>
> </html>
> This is my config.xml:
> <?xml version="1.0" encoding="UTF-8" ?>
>     <widget xmlns = "http://www.w3.org/ns/widgets"
>         xmlns:gap = "http://phonegap.com/ns/1.0"
>         id        = "com.phonegap.example"
>         versionCode="10" <!-- optional: Android only -->
>         version   = "1.0.0">
>     <name>Accurate Battery Status</name>
>     <description>
>         An example for phonegap build docs. 
>     </description>
>     <author href="https://build.phonegap.com" email="support@phonegap.com">
>         Siddiq 
>     </author>
>     <feature name="http://api.phonegap.com/1.0/battery"/>
>     <feature name="http://api.phonegap.com/1.0/camera"/>
>     <feature name="http://api.phonegap.com/1.0/contacts"/>
>     <feature name="http://api.phonegap.com/1.0/file"/>
>     <feature name="http://api.phonegap.com/1.0/geolocation"/>
>     <feature name="http://api.phonegap.com/1.0/media"/>
>     <feature name="http://api.phonegap.com/1.0/network"/>
>     <feature name="http://api.phonegap.com/1.0/notification"/>
> </widget>

--
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