[ 
https://issues.apache.org/jira/browse/CB-10645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16372888#comment-16372888
 ] 

ASF GitHub Bot commented on CB-10645:
-------------------------------------

jcesarmobile closed pull request #31: CB-10645 The battery status handler 
doesn't reinitialize on Android after window.location.reload()
URL: https://github.com/apache/cordova-plugin-battery-status/pull/31
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/android/BatteryListener.java b/src/android/BatteryListener.java
index 740a92e..8814d9e 100755
--- a/src/android/BatteryListener.java
+++ b/src/android/BatteryListener.java
@@ -57,8 +57,7 @@ public BatteryListener() {
     public boolean execute(String action, JSONArray args, CallbackContext 
callbackContext) {
         if (action.equals("start")) {
             if (this.batteryCallbackContext != null) {
-                callbackContext.error( "Battery listener already running.");
-                return true;
+                removeBatteryListener();
             }
             this.batteryCallbackContext = callbackContext;
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> The battery status handler doesn't reinitialize on Android after 
> window.location.reload()
> -----------------------------------------------------------------------------------------
>
>                 Key: CB-10645
>                 URL: https://issues.apache.org/jira/browse/CB-10645
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: cordova-plugin-battery-status
>         Environment: Android
>            Reporter: Aaron Toth
>            Priority: Minor
>              Labels: android, reload, triaged
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Instead of throwing an error, rather remove the status handler and 
> re-initialize.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to