Readonly
Notifier3.0.1
Provides an event to notify in case of connection is changed. In Android, notifier fires the subscribed event with cached value at the first launch. That enables to not miss any changes. Such as, changed value could be missed when application is frozen. However it can be checked by Device.Network.createNotifier#isInitialStickyNotification isInitialStickyNotification .
import Network from '@smartface/native/device/network';
var notifier = new Network.Notifier();
notifier.subscribe(function(connectionType) {
console.log("ConnectionType is " + connectionType);
});
Readonly
notifier3.0.1
Provides an event to notify in case of connection is changed. In Android, notifier fires the subscribed event with cached value at the first launch. That enables to not miss any changes. Such as, changed value could be missed when application is frozen. However it can be checked by Device.Network.createNotifier#isInitialStickyNotification isInitialStickyNotification .
import Network from '@smartface/native/device/network';
var notifier = new Network.Notifier();
notifier.subscribe(function(connectionType) {
console.log("ConnectionType is " + connectionType);
});
Readonly
roamingReturns whether roaming is enabled on the device
0.1
Determines whether the current internet connection is made through wireless, cellular or other Does not determine if the device is actually conntected to the internet. E.g. you could be connected to Wi-Fi but you don't have an IP address. You should ping somewhere (like https://smartface.io) to actually measure if the device is connected to the internet. .
Returns the carrier name of the GSM connection.
0.1
Returns the current connection type.
0.1
Returns the IP address of the current connection.
0.1
Returns if the device is capable of SMS operations.
0.1
Returns the 'International Mobile Subscriber Identity' of the device. Requires the Permissions.android#phone
If your app runs on Android 10 (API level 29) or above, a SecurityException occurs.
0.1
Returns the MAC address of the bluetooth adaptor on the device. This requires the Permissions.android#bluetoothConnect permission.
0.1
Returns the MAC address of the wireless adaptor on the device.
0.1
Checks whether the device is connected to the internet right now. It will ping the given checkUrl parameter. Uses google.com if no parameter is given.
import Network from '@smartface/native/device/network';
Network.isConnected("myprivatenetwork.com");
.then(() => {
console.info("Connected to internet");
})
.catch(() => {
console.error("Not connected to internet");
});
Optional
checkUrl: stringUsed URL for check the internet
Generated using TypeDoc
Since
0.1
Device.Network provides several information about the network connections and adaptors on the device.
Example