UNPKG

1.1 kBTypeScriptView Raw
1/**
2 * Gets the type of connection.
3 * Returns a value from the connectivity.connectionType enumeration.
4 * To use this method on Android you need to have the android.permission.ACCESS_NETWORK_STATE permission added to the AndroidManifest.xml file.
5 */
6export function getConnectionType(): number;
7
8/**
9 * Defines the different connection types.
10 */
11export enum connectionType {
12 /**
13 * Denotes no connection.
14 */
15 none = 0,
16
17 /**
18 * Denotes a WiFi connection.
19 */
20 wifi = 1,
21
22 /**
23 * Denotes a mobile connection, i.e. cellular network or WAN.
24 */
25 mobile = 2,
26
27 /**
28 * Denotes an ethernet connection
29 */
30 ethernet = 3,
31
32 /**
33 * Denotes a bluetooth connection
34 */
35 bluetooth = 4,
36
37 /**
38 * Denotes a vpn connection
39 */
40 vpn = 5,
41}
42
43/**
44 * Starts monitoring the connection type.
45 * @param connectionTypeChangedCallback A function that will be called when the connection type changes.
46 */
47export function startMonitoring(connectionTypeChangedCallback: (newConnectionType: number) => void): void;
48
49/**
50 * Stops monitoring the connection type.
51 */
52export function stopMonitoring(): void;