Skip to main content
Version: 7.2.0

Network

API Reference: Device.Network

Network is used to retrieve information about the network connections and adapters on the device.

TypeScript
import PageSampleDesign from "generated/pages/page3";
import { Route, Router } from "@smartface/router";
import Application from "@smartface/native/application";
import Network from "@smartface/native/device/network";



//You should create new Page from UI-Editor and extend with it.
export default class Sample extends PageSampleDesign {
constructor(private router?: Router, private route?: Route) {
super({});
}

onShow() {
super.onShow();
const { headerBar } = this;
Application.statusBar.visible = false;
headerBar.visible = false;

}

onLoad() {
super.onLoad();
console.log("Device.Network.SMSEnabled: " + Network.SMSEnabled);
console.log(
"Device.Network.bluetoothMacAddress: " + Network.bluetoothMacAddress
);
console.log("Device.Network.carrier: " + Network.carrier);
console.log("Device.Network.connectionType: " + Network.connectionType);
console.log("Device.Network.roamingEnabled: " + Network.roamingEnabled);
console.log("Device.Network.connectionIP: " + Network.connectionIP);
console.log(
"Device.Network.wirelessMacAddress: " + Network.wirelessMacAddress
);

Network.notifier.subscribe((connectionType) => {
console.log("ConnectionType is " + connectionType);
});
}
}