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

View File

@ -1,16 +1,22 @@
import { Injectable } from '@angular/core'; 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({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })
export class MyBatteryInfoService { export class MyBatteryInfoService {
constructor() { } public getBatteryLife() {
/* public getPowerPercent (): number { if (iosApp){
power.startPowerUpdates(function(Info) { iosUtils.getter(UIDevice, UIDevice.currentDevice).batteryMonitoringEnabled = true;
power.stopPowerUpdates(); let battery = +(iosUtils.getter(UIDevice, UIDevice.currentDevice).batteryLevel * 100);
return Info.percentage; }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;
});
}
}
} }