diff --git a/client/Nightr/reference.d.ts b/client/Nightr/reference.d.ts new file mode 100644 index 0000000..95aa993 --- /dev/null +++ b/client/Nightr/reference.d.ts @@ -0,0 +1,3 @@ +/// +/// +/// diff --git a/client/Nightr/src/app/services/my-battery-info.service.ts b/client/Nightr/src/app/services/my-battery-info.service.ts index 2906c36..209807f 100644 --- a/client/Nightr/src/app/services/my-battery-info.service.ts +++ b/client/Nightr/src/app/services/my-battery-info.service.ts @@ -7,6 +7,18 @@ import { ios as iosUtils } from "tns-core-modules/utils/utils"; }) export class MyBatteryInfoService { + + /* public getBatteryLife() { + // use tns-platform-dclarations to access native APIs (e.g. android.content.Intent) + applicationModule.android.registerBroadcastReceiver( + android.content.Intent.ACTION_BATTERY_CHANGED, + (androidContext, intent) => { + const level = intent.getIntExtra(android.os.BatteryManager.EXTRA_LEVEL, -1); + const scale = intent.getIntExtra(android.os.BatteryManager.EXTRA_SCALE, -1); + const percent = (level / scale) * 100.0; + vm.set("batteryLife", percent.toString()); + }); + } */ /*public getBatteryLife() { if (iosApp){ iosUtils.getter(UIDevice, UIDevice.currentDevice).batteryMonitoringEnabled = true;