Skip to content
Permalink
Browse files
CB-7976 Android: Use webView's context rather than Activity's context…
… for intent receiver
  • Loading branch information
agrieve committed Nov 6, 2014
1 parent 6725aa9 commit 9f477a136e2ec83bf3c085ac12574b4a9c16fca1
Showing 1 changed file with 2 additions and 2 deletions.
@@ -72,7 +72,7 @@ public void onReceive(Context context, Intent intent) {
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 void onReset() {
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);

0 comments on commit 9f477a1

Please sign in to comment.