cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject cordova-plugin-battery-status git commit: CB-7976 Android: Use webView's context rather than Activity's context for intent receiver
Date Thu, 06 Nov 2014 21:25:42 GMT
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 <agrieve@chromium.org>
Authored: Thu Nov 6 16:19:00 2014 -0500
Committer: Andrew Grieve <agrieve@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


Mime
View raw message