From dd13101bcb335c236f673c7dc017de125550dd09 Mon Sep 17 00:00:00 2001 From: Whizel Date: Sun, 7 Apr 2019 05:01:01 +0200 Subject: [PATCH] dunno --- client/Nightr/reference.d.ts | 3 +++ .../src/app/services/my-battery-info.service.ts | 12 ++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 client/Nightr/reference.d.ts 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;