You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2014/11/06 22:25:42 UTC

cordova-plugin-battery-status git commit: CB-7976 Android: Use webView's context rather than Activity's context for intent receiver

Repository: cordova-plugin-battery-status
Updated Branches:
  refs/heads/master 6725aa985 -> 9f477a136


CB-7976 Android: Use webView's context rather than Activity's context for intent receiver


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-battery-status/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-battery-status/commit/9f477a13
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-battery-status/tree/9f477a13
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-battery-status/diff/9f477a13

Branch: refs/heads/master
Commit: 9f477a136e2ec83bf3c085ac12574b4a9c16fca1
Parents: 6725aa9
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Nov 6 16:19:00 2014 -0500
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Nov 6 16:19:00 2014 -0500

----------------------------------------------------------------------
 src/android/BatteryListener.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-battery-status/blob/9f477a13/src/android/BatteryListener.java
----------------------------------------------------------------------
diff --git a/src/android/BatteryListener.java b/src/android/BatteryListener.java
index ca47faa..740a92e 100755
--- a/src/android/BatteryListener.java
+++ b/src/android/BatteryListener.java
@@ -72,7 +72,7 @@ public class BatteryListener extends CordovaPlugin {
                         updateBatteryInfo(intent);
                     }
                 };
-                cordova.getActivity().registerReceiver(this.receiver, intentFilter);
+                webView.getContext().registerReceiver(this.receiver, intentFilter);
             }
 
             // Don't return any result now, since status results will be sent when events come in from broadcast receiver
@@ -113,7 +113,7 @@ public class BatteryListener extends CordovaPlugin {
     private void removeBatteryListener() {
         if (this.receiver != null) {
             try {
-                this.cordova.getActivity().unregisterReceiver(this.receiver);
+                webView.getContext().unregisterReceiver(this.receiver);
                 this.receiver = null;
             } catch (Exception e) {
                 Log.e(LOG_TAG, "Error unregistering battery receiver: " + e.getMessage(), e);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org