commit before pull

This commit is contained in:
Viktor Søndergaard 2019-04-06 23:29:16 +02:00
parent f47982f094
commit 43f117e518
2 changed files with 16 additions and 10 deletions

View File

@ -31,7 +31,7 @@ export class AppComponent {
return this.cameraService.takePicture().
then(picture => {
this.image = JSON.stringify(picture);
console.log('this is picture in json', JSON.stringify(picture));
//console.log('this is picture in json', JSON.stringify(picture));
this.getLocation();
})
}
@ -39,7 +39,7 @@ export class AppComponent {
public getLocation(): any {
this.geoLocationService.getLocation().then(location => {
this.locationData = location;
console.log('this is locationData', this.locationData);
//console.log('this is locationData', this.locationData);
this.submit();
}).catch(error => {
});

View File

@ -1,16 +1,22 @@
import { Injectable } from '@angular/core';
import * as power from 'nativescript-powerinfo'
import { android as androidApp, ios as iosApp } from "tns-core-modules/application";
import { ios as iosUtils } from "tns-core-modules/utils/utils";
@Injectable({
providedIn: 'root'
})
export class MyBatteryInfoService {
constructor() { }
/* public getPowerPercent (): number {
power.startPowerUpdates(function(Info) {
power.stopPowerUpdates();
return Info.percentage;
})
} */
public getBatteryLife() {
if (iosApp){
iosUtils.getter(UIDevice, UIDevice.currentDevice).batteryMonitoringEnabled = true;
let battery = +(iosUtils.getter(UIDevice, UIDevice.currentDevice).batteryLevel * 100);
}else{
androidApp.registerBroadcastReceiver(android.content.Intent.ACTION_BATTERY_CHANGED,(context: android.content.Context, intent: android.content.Intent) =>{
let level = intent.getIntExtra(android.os.BatteryManager.EXTRA_LEVEL, -1);
let scale = intent.getIntExtra(android.os.BatteryManager.EXTRA_SCALE, -1);
let percent = (level / scale) * 100.0;
});
}
}
}