Skip to content

removed deprecated APIs #384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export class AppUsingAndroidExampleComponent {
let packageName = androidApp.packageName; // The package ID e.g. org.nativescript.nativescriptsdkexamplesng
let nativeApp = androidApp.nativeApp; // The native APplication reference
let foregroundActivity = androidApp.foregroundActivity; // The current Activity reference
let currentContext = androidApp.currentContext; // The current Android context
let context = androidApp.context; console.log(context); // The current Android context
// << app-class-properties

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Component } from "@angular/core";
import { android as androidApp, ios as iosApp } from "tns-core-modules/application";
import { ios as iosUtils } from "tns-core-modules/utils/utils";

@Component({
moduleId: module.id,
Expand Down Expand Up @@ -33,13 +32,13 @@ export class AppUsingIosExampleComponent {
this.batteryLife = 0;

// >> app-ios-observer-code
iosUtils.getter(UIDevice, UIDevice.currentDevice).batteryMonitoringEnabled = true;
this.batteryLife = +(iosUtils.getter(UIDevice, UIDevice.currentDevice).batteryLevel * 100);
UIDevice.currentDevice.batteryMonitoringEnabled = true;
this.batteryLife = +(UIDevice.currentDevice.batteryLevel * 100);

let that = this;
let observer = iosApp.addNotificationObserver(UIDeviceBatteryLevelDidChangeNotification,
function onReceiveCallback(notification: NSNotification) {
that.batteryLife = +(iosUtils.getter(UIDevice, UIDevice.currentDevice).batteryLevel * 100);
that.batteryLife = +(UIDevice.currentDevice.batteryLevel * 100);
});
// << app-ios-observer-code

Expand Down