diff --git a/wear/src/main/AndroidManifest.xml b/wear/src/main/AndroidManifest.xml
index b16b04f6d1..04b178307d 100644
--- a/wear/src/main/AndroidManifest.xml
+++ b/wear/src/main/AndroidManifest.xml
@@ -100,6 +100,9 @@
+
+
+
@@ -544,6 +547,7 @@
+
diff --git a/wear/src/main/java/info/nightscout/androidaps/watchfaces/Home2.java b/wear/src/main/java/info/nightscout/androidaps/watchfaces/Home2.java
index 458fa048cd..180b1dd935 100644
--- a/wear/src/main/java/info/nightscout/androidaps/watchfaces/Home2.java
+++ b/wear/src/main/java/info/nightscout/androidaps/watchfaces/Home2.java
@@ -1,5 +1,7 @@
package info.nightscout.androidaps.watchfaces;
+import android.content.BroadcastReceiver;
+import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Color;
@@ -29,9 +31,28 @@ public class Home2 extends BaseWatchFace {
super.onCreate();
LayoutInflater inflater = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
layoutView = inflater.inflate(R.layout.activity_home_2, null);
+
+ IntentFilter intentBatteryFilter = new IntentFilter();
+ intentBatteryFilter.addAction(BatteryManager.ACTION_CHARGING);
+ intentBatteryFilter.addAction(BatteryManager.ACTION_DISCHARGING);
+ registerReceiver(batteryReceiver, intentBatteryFilter);
performViewSetup();
}
+ private BroadcastReceiver batteryReceiver = new BroadcastReceiver() {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ setDataFields();
+ invalidate();
+ }
+ };
+
+ @Override
+ public void onDestroy() {
+ unregisterReceiver(batteryReceiver);
+ super.onDestroy();
+ }
+
@Override
protected void onTapCommand(int tapType, int x, int y, long eventTime) {