expo-cellular 3.0.0 โ 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +55 -0
- package/README.md +10 -1
- package/android/build.gradle +30 -16
- package/android/src/main/java/expo/modules/cellular/CellularGeneration.kt +9 -0
- package/android/src/main/java/expo/modules/cellular/CellularModule.kt +102 -0
- package/app.plugin.js +1 -0
- package/build/Cellular.d.ts +195 -5
- package/build/Cellular.js +228 -3
- package/build/Cellular.js.map +1 -1
- package/build/Cellular.types.d.ts +21 -1
- package/build/Cellular.types.js +21 -0
- package/build/Cellular.types.js.map +1 -1
- package/build/ExpoCellular.d.ts +1 -1
- package/build/ExpoCellular.js +1 -1
- package/build/ExpoCellular.js.map +1 -1
- package/build/ExpoCellular.web.d.ts +5 -0
- package/build/ExpoCellular.web.js +16 -4
- package/build/ExpoCellular.web.js.map +1 -1
- package/expo-module.config.json +10 -0
- package/ios/CellularModule.swift +116 -0
- package/ios/{EXCellular.podspec โ ExpoCellular.podspec} +13 -5
- package/package.json +6 -5
- package/plugin/build/withCellular.d.ts +3 -0
- package/plugin/build/withCellular.js +12 -0
- package/plugin/src/withCellular.ts +13 -0
- package/plugin/tsconfig.json +9 -0
- package/src/Cellular.ts +240 -6
- package/src/Cellular.types.ts +21 -0
- package/src/ExpoCellular.ts +1 -1
- package/src/ExpoCellular.web.ts +17 -4
- package/src/ts-declarations/lib.dom.d.ts +18 -0
- package/android/src/main/java/expo/modules/cellular/CellularModule.java +0 -115
- package/android/src/main/java/expo/modules/cellular/CellularPackage.java +0 -17
- package/ios/EXCellular/EXCellularModule.h +0 -22
- package/ios/EXCellular/EXCellularModule.m +0 -90
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,61 @@
|
|
|
8
8
|
|
|
9
9
|
### ๐ Bug fixes
|
|
10
10
|
|
|
11
|
+
### ๐ก Others
|
|
12
|
+
|
|
13
|
+
## 4.1.0 โ 2021-12-03
|
|
14
|
+
|
|
15
|
+
### ๐ก Others
|
|
16
|
+
|
|
17
|
+
- Removed legacy Objective-C implementation and changed the pod name to `ExpoCellular`. ([#15082](https://github.com/expo/expo/pull/15082) by [@tsapeta](https://github.com/tsapeta))
|
|
18
|
+
|
|
19
|
+
## 4.0.0 โ 2021-09-28
|
|
20
|
+
|
|
21
|
+
### ๐ Breaking changes
|
|
22
|
+
|
|
23
|
+
- Deprecated module's constants in favor of new methods returning up-to-date data. ([#13729](https://github.com/expo/expo/pull/13729) by [@m1st4ke](https://github.com/m1st4ke))
|
|
24
|
+
- Dropped support for iOS 11.0 ([#14383](https://github.com/expo/expo/pull/14383) by [@cruzach](https://github.com/cruzach))
|
|
25
|
+
|
|
26
|
+
### ๐ New features
|
|
27
|
+
|
|
28
|
+
- Added 5G cellular support ([#13713](https://github.com/expo/expo/pull/13713) by [@m1st4ke](https://github.com/m1st4ke))
|
|
29
|
+
- Added methods returning up-to-date data. ([#13729](https://github.com/expo/expo/pull/13729) by [@m1st4ke](https://github.com/m1st4ke))
|
|
30
|
+
|
|
31
|
+
### ๐ Bug fixes
|
|
32
|
+
|
|
33
|
+
- Fix building errors from use_frameworks! in Podfile. ([#14523](https://github.com/expo/expo/pull/14523) by [@kudo](https://github.com/kudo))
|
|
34
|
+
|
|
35
|
+
### ๐ก Others
|
|
36
|
+
|
|
37
|
+
- Added experimental opt-in implementation in Swift ([#13523](https://github.com/expo/expo/pull/13523) by [@tsapeta](https://github.com/tsapeta))
|
|
38
|
+
- Rewrote Android part from Java to Kotlin ([#13694](https://github.com/expo/expo/pull/13694) by [@m1st4ke](https://github.com/m1st4ke))
|
|
39
|
+
|
|
40
|
+
## 3.2.0 โ 2021-06-16
|
|
41
|
+
|
|
42
|
+
### ๐ New features
|
|
43
|
+
|
|
44
|
+
- [plugin] Created config plugin for applying permissions on Android ([#13175](https://github.com/expo/expo/pull/13175) by [@EvanBacon](https://github.com/EvanBacon))
|
|
45
|
+
|
|
46
|
+
### ๐ Bug fixes
|
|
47
|
+
|
|
48
|
+
- Fix null cellular information on iOS. ([#12710](https://github.com/expo/expo/pull/12710) by [@randomhajile](https://github.com/randomhajile))
|
|
49
|
+
- Enable kotlin in all modules. ([#12716](https://github.com/expo/expo/pull/12716) by [@wschurman](https://github.com/wschurman))
|
|
50
|
+
- Add TypeScript types to the exported constants: `allowsVoip`, `carrier`, `isoCountryCode`, `mobileCountryCode` and `mobileNetworkCode`. ([#12838](https://github.com/expo/expo/pull/12838) by [@simek](https://github.com/simek))
|
|
51
|
+
|
|
52
|
+
### ๐ก Others
|
|
53
|
+
|
|
54
|
+
- Build Android code using Java 8 to fix Android instrumented test build error. ([#12939](https://github.com/expo/expo/pull/12939) by [@kudo](https://github.com/kudo))
|
|
55
|
+
|
|
56
|
+
## 3.1.0 โ 2021-03-10
|
|
57
|
+
|
|
58
|
+
### ๐ New features
|
|
59
|
+
|
|
60
|
+
- Updated Android build configuration to target Android 11 (added support for Android SDK 30). ([#11647](https://github.com/expo/expo/pull/11647) by [@bbarthec](https://github.com/bbarthec))
|
|
61
|
+
|
|
62
|
+
### ๐ Bug fixes
|
|
63
|
+
|
|
64
|
+
- Remove peerDependencies and unimodulePeerDependencies from Expo modules. ([#11980](https://github.com/expo/expo/pull/11980) by [@brentvatne](https://github.com/brentvatne))
|
|
65
|
+
|
|
11
66
|
## 3.0.0 โ 2021-01-15
|
|
12
67
|
|
|
13
68
|
### ๐ Breaking changes
|
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ For managed [managed](https://docs.expo.io/versions/latest/introduction/managed-
|
|
|
13
13
|
|
|
14
14
|
# Installation in bare React Native projects
|
|
15
15
|
|
|
16
|
-
For bare React Native projects, you must ensure that you have [installed and configured the `
|
|
16
|
+
For bare React Native projects, you must ensure that you have [installed and configured the `expo` package](https://docs.expo.dev/bare/installing-expo-modules/) before continuing.
|
|
17
17
|
|
|
18
18
|
### Add the package to your npm dependencies
|
|
19
19
|
|
|
@@ -21,6 +21,15 @@ For bare React Native projects, you must ensure that you have [installed and con
|
|
|
21
21
|
expo install expo-cellular
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
### Configure for Android
|
|
25
|
+
|
|
26
|
+
This package requires the `android.permission.READ_PHONE_STATE` be added to your `AndroidManifest.xml`, this is used for `TelephonyManager` on Android. We **do not** require the more risky `READ_PRIVILEGED_PHONE_STATE` permission.
|
|
27
|
+
|
|
28
|
+
```xml
|
|
29
|
+
<!-- Added permissions -->
|
|
30
|
+
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
|
31
|
+
```
|
|
32
|
+
|
|
24
33
|
# Contributing
|
|
25
34
|
|
|
26
35
|
Contributions are very welcome! Please refer to guidelines described in the [contributing guide](https://github.com/expo/expo#contributing).
|
package/android/build.gradle
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
apply plugin: 'com.android.library'
|
|
2
|
+
apply plugin: 'kotlin-android'
|
|
2
3
|
apply plugin: 'maven'
|
|
3
4
|
|
|
4
5
|
group = 'host.exp.exponent'
|
|
5
|
-
version = '
|
|
6
|
+
version = '4.1.0'
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
buildscript {
|
|
9
|
+
// Simple helper that allows the root project to override versions declared by this library.
|
|
10
|
+
ext.safeExtGet = { prop, fallback ->
|
|
11
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
repositories {
|
|
15
|
+
mavenCentral()
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
dependencies {
|
|
19
|
+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet('kotlinVersion', '1.4.21')}")
|
|
20
|
+
}
|
|
10
21
|
}
|
|
11
22
|
|
|
12
23
|
// Upload android library to maven with javadoc and android sources
|
|
@@ -35,27 +46,30 @@ uploadArchives {
|
|
|
35
46
|
}
|
|
36
47
|
|
|
37
48
|
android {
|
|
38
|
-
compileSdkVersion safeExtGet("compileSdkVersion",
|
|
49
|
+
compileSdkVersion safeExtGet("compileSdkVersion", 30)
|
|
50
|
+
|
|
51
|
+
compileOptions {
|
|
52
|
+
sourceCompatibility JavaVersion.VERSION_1_8
|
|
53
|
+
targetCompatibility JavaVersion.VERSION_1_8
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
kotlinOptions {
|
|
57
|
+
jvmTarget = JavaVersion.VERSION_1_8
|
|
58
|
+
}
|
|
39
59
|
|
|
40
60
|
defaultConfig {
|
|
41
61
|
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
42
|
-
targetSdkVersion safeExtGet("targetSdkVersion",
|
|
62
|
+
targetSdkVersion safeExtGet("targetSdkVersion", 30)
|
|
43
63
|
versionCode 11
|
|
44
|
-
versionName '
|
|
64
|
+
versionName '4.1.0'
|
|
45
65
|
}
|
|
46
66
|
lintOptions {
|
|
47
67
|
abortOnError false
|
|
48
68
|
}
|
|
49
69
|
}
|
|
50
70
|
|
|
51
|
-
if (new File(rootProject.projectDir.parentFile, 'package.json').exists()) {
|
|
52
|
-
apply from: project(":unimodules-core").file("../unimodules-core.gradle")
|
|
53
|
-
} else {
|
|
54
|
-
throw new GradleException(
|
|
55
|
-
'\'unimodules-core.gradle\' was not found in the usual React Native dependency location. ' +
|
|
56
|
-
'This package can only be used in such projects. Are you sure you\'ve installed the dependencies properly?')
|
|
57
|
-
}
|
|
58
|
-
|
|
59
71
|
dependencies {
|
|
60
|
-
|
|
72
|
+
implementation project(':expo-modules-core')
|
|
73
|
+
|
|
74
|
+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${safeExtGet('kotlinVersion', '1.4.21')}"
|
|
61
75
|
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
package expo.modules.cellular
|
|
2
|
+
|
|
3
|
+
import android.annotation.SuppressLint
|
|
4
|
+
import android.content.Context
|
|
5
|
+
import android.net.sip.SipManager
|
|
6
|
+
import android.os.Build
|
|
7
|
+
import android.telephony.TelephonyManager
|
|
8
|
+
import android.util.Log
|
|
9
|
+
import expo.modules.kotlin.modules.Module
|
|
10
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
11
|
+
|
|
12
|
+
const val moduleName = "ExpoCellular"
|
|
13
|
+
|
|
14
|
+
class CellularModule : Module() {
|
|
15
|
+
override fun definition() = ModuleDefinition {
|
|
16
|
+
name(moduleName)
|
|
17
|
+
constants {
|
|
18
|
+
val telephonyManager = telephonyManager()
|
|
19
|
+
mapOf(
|
|
20
|
+
"allowsVoip" to SipManager.isVoipSupported(context),
|
|
21
|
+
"isoCountryCode" to telephonyManager?.simCountryIso,
|
|
22
|
+
"carrier" to telephonyManager?.simOperatorName,
|
|
23
|
+
"mobileCountryCode" to telephonyManager?.simOperator?.substring(0, 3),
|
|
24
|
+
"mobileNetworkCode" to telephonyManager?.simOperator?.substring(3)
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function("getCellularGenerationAsync") {
|
|
29
|
+
try {
|
|
30
|
+
getCurrentGeneration()
|
|
31
|
+
} catch (e: SecurityException) {
|
|
32
|
+
Log.w(moduleName, "READ_PHONE_STATE permission is required to acquire network type", e)
|
|
33
|
+
CellularGeneration.UNKNOWN.value
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function("allowsVoipAsync") {
|
|
38
|
+
SipManager.isVoipSupported(context)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function("getIsoCountryCodeAsync") {
|
|
42
|
+
telephonyManager()?.simCountryIso
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function("getCarrierNameAsync") {
|
|
46
|
+
telephonyManager()?.simOperatorName
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function("getMobileCountryCodeAsync") {
|
|
50
|
+
telephonyManager()?.simOperator?.substring(0, 3)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function("getMobileNetworkCodeAsync") {
|
|
54
|
+
telephonyManager()?.simOperator?.substring(3)
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
private fun telephonyManager() =
|
|
59
|
+
(context.getSystemService(Context.TELEPHONY_SERVICE) as? TelephonyManager).takeIf {
|
|
60
|
+
it?.simState == TelephonyManager.SIM_STATE_READY
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private val context
|
|
64
|
+
get() = requireNotNull(appContext.reactContext)
|
|
65
|
+
|
|
66
|
+
@SuppressLint("MissingPermission")
|
|
67
|
+
private fun getCurrentGeneration(): Int {
|
|
68
|
+
val telephonyManager = telephonyManager()
|
|
69
|
+
?: return CellularGeneration.UNKNOWN.value
|
|
70
|
+
val networkType = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
|
71
|
+
telephonyManager.dataNetworkType
|
|
72
|
+
} else {
|
|
73
|
+
telephonyManager.networkType
|
|
74
|
+
}
|
|
75
|
+
return when (networkType) {
|
|
76
|
+
TelephonyManager.NETWORK_TYPE_GPRS,
|
|
77
|
+
TelephonyManager.NETWORK_TYPE_EDGE,
|
|
78
|
+
TelephonyManager.NETWORK_TYPE_CDMA,
|
|
79
|
+
TelephonyManager.NETWORK_TYPE_1xRTT,
|
|
80
|
+
TelephonyManager.NETWORK_TYPE_IDEN -> {
|
|
81
|
+
CellularGeneration.CG_2G.value
|
|
82
|
+
}
|
|
83
|
+
TelephonyManager.NETWORK_TYPE_UMTS,
|
|
84
|
+
TelephonyManager.NETWORK_TYPE_EVDO_0,
|
|
85
|
+
TelephonyManager.NETWORK_TYPE_EVDO_A,
|
|
86
|
+
TelephonyManager.NETWORK_TYPE_HSDPA,
|
|
87
|
+
TelephonyManager.NETWORK_TYPE_HSUPA,
|
|
88
|
+
TelephonyManager.NETWORK_TYPE_HSPA,
|
|
89
|
+
TelephonyManager.NETWORK_TYPE_EVDO_B,
|
|
90
|
+
TelephonyManager.NETWORK_TYPE_EHRPD,
|
|
91
|
+
TelephonyManager.NETWORK_TYPE_HSPAP -> {
|
|
92
|
+
CellularGeneration.CG_3G.value
|
|
93
|
+
}
|
|
94
|
+
TelephonyManager.NETWORK_TYPE_LTE -> {
|
|
95
|
+
CellularGeneration.CG_4G.value
|
|
96
|
+
}
|
|
97
|
+
else -> {
|
|
98
|
+
CellularGeneration.UNKNOWN.value
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
package/app.plugin.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./plugin/build/withCellular');
|
package/build/Cellular.d.ts
CHANGED
|
@@ -1,8 +1,198 @@
|
|
|
1
1
|
import { CellularGeneration } from './Cellular.types';
|
|
2
2
|
export { CellularGeneration };
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Indicates if the carrier allows making VoIP calls on its network. On Android, this checks whether
|
|
5
|
+
* the system supports SIP-based VoIP API. See [here](https://developer.android.com/reference/android/net/sip/SipManager.html#isVoipSupported(android.content.Context))
|
|
6
|
+
* to view more information.
|
|
7
|
+
*
|
|
8
|
+
* On iOS, if you configure a device for a carrier and then remove the SIM card, this property
|
|
9
|
+
* retains the `boolean` value indicating the carrierโs policy regarding VoIP. If you then install
|
|
10
|
+
* a new SIM card, its VoIP policy `boolean` replaces the previous value of this property.
|
|
11
|
+
*
|
|
12
|
+
* On web, this returns `null`.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* Cellular.allowsVoip; // true or false
|
|
17
|
+
* ```
|
|
18
|
+
* @deprecated Deprecated field, use [`allowsVoipAsync()`](#allowsvoipasync) instead.
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
export declare const allowsVoip: boolean | null;
|
|
22
|
+
/**
|
|
23
|
+
* The name of the userโs home cellular service provider. If the device has dual SIM cards, only the
|
|
24
|
+
* carrier for the currently active SIM card will be returned. On Android, this value is only
|
|
25
|
+
* available when the SIM state is [`SIM_STATE_READY`](https://developer.android.com/reference/android/telephony/TelephonyManager.html#SIM_STATE_READY).
|
|
26
|
+
* Otherwise, this returns `null`.
|
|
27
|
+
*
|
|
28
|
+
* On iOS, if you configure a device for a carrier and then remove the SIM card, this property
|
|
29
|
+
* retains the name of the carrier. If you then install a new SIM card, its carrier name replaces
|
|
30
|
+
* the previous value of this property. The value for this property is `null` if the user never
|
|
31
|
+
* configured a carrier for the device.
|
|
32
|
+
*
|
|
33
|
+
* On web, this returns `null`.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* Cellular.carrier; // "T-Mobile" or "Verizon"
|
|
38
|
+
* ```
|
|
39
|
+
* @deprecated Deprecated field, use [`getCarrierNameAsync()`](#getcarriernameasync) instead.
|
|
40
|
+
*
|
|
41
|
+
*/
|
|
42
|
+
export declare const carrier: string | null;
|
|
43
|
+
/**
|
|
44
|
+
* The ISO country code for the userโs cellular service provider. On iOS, the value is `null` if any
|
|
45
|
+
* of the following apply:
|
|
46
|
+
* - The device is in airplane mode.
|
|
47
|
+
* - There is no SIM card in the device.
|
|
48
|
+
* - The device is outside of cellular service range.
|
|
49
|
+
*
|
|
50
|
+
* On web, this returns `null`.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* Cellular.isoCountryCode; // "us" or "au"
|
|
55
|
+
* ```
|
|
56
|
+
* @deprecated Deprecated field, use [`getIsoCountryCodeAsync()`](#getisocountrycodeAsync) instead.
|
|
57
|
+
*
|
|
58
|
+
*/
|
|
59
|
+
export declare const isoCountryCode: string | null;
|
|
60
|
+
/**
|
|
61
|
+
* The mobile country code (MCC) for the userโs current registered cellular service provider.
|
|
62
|
+
* On Android, this value is only available when SIM state is [`SIM_STATE_READY`](https://developer.android.com/reference/android/telephony/TelephonyManager.html#SIM_STATE_READY). Otherwise, this
|
|
63
|
+
* returns `null`. On iOS, the value may be null on hardware prior to iPhone 4S when in airplane mode.
|
|
64
|
+
* Furthermore, the value for this property is `null` if any of the following apply:
|
|
65
|
+
* - There is no SIM card in the device.
|
|
66
|
+
* - The device is outside of cellular service range.
|
|
67
|
+
*
|
|
68
|
+
* On web, this returns `null`.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* Cellular.mobileCountryCode; // "310"
|
|
73
|
+
* ```
|
|
74
|
+
* @deprecated Deprecated field, use [`getMobileCountryCodeAsync()`](#getmobilecountrycodeasync) instead.
|
|
75
|
+
*
|
|
76
|
+
*/
|
|
77
|
+
export declare const mobileCountryCode: string | null;
|
|
78
|
+
/**
|
|
79
|
+
* The ISO country code for the userโs cellular service provider. On iOS, the value is `null` if
|
|
80
|
+
* any of the following apply:
|
|
81
|
+
* - The device is in airplane mode.
|
|
82
|
+
* - There is no SIM card in the device.
|
|
83
|
+
* - The device is outside of cellular service range.
|
|
84
|
+
*
|
|
85
|
+
* On web, this returns `null`.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* Cellular.mobileNetworkCode; // "260"
|
|
90
|
+
* ```
|
|
91
|
+
* @deprecated Deprecated field, use [`getMobileNetworkCodeAsync()`](#getmobilenetworkcodeasync) instead.
|
|
92
|
+
*
|
|
93
|
+
*/
|
|
94
|
+
export declare const mobileNetworkCode: string | null;
|
|
95
|
+
/**
|
|
96
|
+
* @return Returns a promise which fulfils with a [`Cellular.CellularGeneration`](#cellulargeneration)
|
|
97
|
+
* enum value that represents the current cellular-generation type.
|
|
98
|
+
*
|
|
99
|
+
* On web, this method uses [`navigator.connection.effectiveType`](https://developer.mozilla.org/en-US/docs/Web/API/NetworkInformation/effectiveType)
|
|
100
|
+
* to detect the effective type of the connection using a combination of recently observed
|
|
101
|
+
* round-trip time and downlink values. See [here](https://developer.mozilla.org/en-US/docs/Web/API/Network_Information_API)
|
|
102
|
+
* to view browser compatibility.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```ts
|
|
106
|
+
* await Cellular.getCellularGenerationAsync();
|
|
107
|
+
* // CellularGeneration.CELLULAR_4G
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
8
110
|
export declare function getCellularGenerationAsync(): Promise<CellularGeneration>;
|
|
111
|
+
/**
|
|
112
|
+
* @return Returns if the carrier allows making VoIP calls on its network. On Android, this checks whether
|
|
113
|
+
* the system supports SIP-based VoIP API. See [here](https://developer.android.com/reference/android/net/sip/SipManager.html#isVoipSupported(android.content.Context))
|
|
114
|
+
* to view more information.
|
|
115
|
+
*
|
|
116
|
+
* On iOS, if you configure a device for a carrier and then remove the SIM card, this property
|
|
117
|
+
* retains the `boolean` value indicating the carrierโs policy regarding VoIP. If you then install
|
|
118
|
+
* a new SIM card, its VoIP policy `boolean` replaces the previous value of this property.
|
|
119
|
+
*
|
|
120
|
+
* On web, this returns `null`.
|
|
121
|
+
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```ts
|
|
124
|
+
* await Cellular.allowsVoipAsync(); // true or false
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
export declare function allowsVoipAsync(): Promise<boolean | null>;
|
|
128
|
+
/**
|
|
129
|
+
* @return Returns the ISO country code for the userโs cellular service provider.
|
|
130
|
+
*
|
|
131
|
+
* On iOS, the value is `null` if any of the following apply:
|
|
132
|
+
* - The device is in airplane mode.
|
|
133
|
+
* - There is no SIM card in the device.
|
|
134
|
+
* - The device is outside of cellular service range.
|
|
135
|
+
*
|
|
136
|
+
* On web, this returns `null`.
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```ts
|
|
140
|
+
* await Cellular.getIsoCountryCodeAsync(); // "us" or "au"
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
*/
|
|
144
|
+
export declare function getIsoCountryCodeAsync(): Promise<string | null>;
|
|
145
|
+
/**
|
|
146
|
+
* @return Returns name of the userโs home cellular service provider. If the device has dual SIM cards, only the
|
|
147
|
+
* carrier for the currently active SIM card will be returned.
|
|
148
|
+
*
|
|
149
|
+
* On Android, this value is only available when the SIM state is [`SIM_STATE_READY`](https://developer.android.com/reference/android/telephony/TelephonyManager.html#SIM_STATE_READY).
|
|
150
|
+
* Otherwise, this returns `null`.
|
|
151
|
+
*
|
|
152
|
+
* On iOS, if you configure a device for a carrier and then remove the SIM card, this property
|
|
153
|
+
* retains the name of the carrier. If you then install a new SIM card, its carrier name replaces
|
|
154
|
+
* the previous value of this property. The value for this property is `null` if the user never
|
|
155
|
+
* configured a carrier for the device.
|
|
156
|
+
*
|
|
157
|
+
* On web, this returns `null`.
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```ts
|
|
161
|
+
* await Cellular.getCarrierNameAsync(); // "T-Mobile" or "Verizon"
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
export declare function getCarrierNameAsync(): Promise<string | null>;
|
|
165
|
+
/**
|
|
166
|
+
* @return Returns mobile country code (MCC) for the userโs current registered cellular service provider.
|
|
167
|
+
*
|
|
168
|
+
* On Android, this value is only available when SIM state is [`SIM_STATE_READY`](https://developer.android.com/reference/android/telephony/TelephonyManager.html#SIM_STATE_READY). Otherwise, this
|
|
169
|
+
* returns `null`. On iOS, the value may be null on hardware prior to iPhone 4S when in airplane mode.
|
|
170
|
+
* Furthermore, the value for this property is `null` if any of the following apply:
|
|
171
|
+
* - There is no SIM card in the device.
|
|
172
|
+
* - The device is outside of cellular service range.
|
|
173
|
+
*
|
|
174
|
+
* On web, this returns `null`.
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* ```ts
|
|
178
|
+
* await Cellular.getMobileCountryCodeAsync(); // "310"
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
export declare function getMobileCountryCodeAsync(): Promise<string | null>;
|
|
182
|
+
/**
|
|
183
|
+
* @return Returns the mobile network code (MNC) for the userโs current registered cellular service provider.
|
|
184
|
+
*
|
|
185
|
+
* On Android, this value is only available when SIM state is [`SIM_STATE_READY`](https://developer.android.com/reference/android/telephony/TelephonyManager.html#SIM_STATE_READY). Otherwise, this
|
|
186
|
+
* returns `null`. On iOS, the value may be null on hardware prior to iPhone 4S when in airplane mode.
|
|
187
|
+
* Furthermore, the value for this property is `null` if any of the following apply:
|
|
188
|
+
* - There is no SIM card in the device.
|
|
189
|
+
* - The device is outside of cellular service range.
|
|
190
|
+
*
|
|
191
|
+
* On web, this returns `null`.
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* ```ts
|
|
195
|
+
* await Cellular.getMobileNetworkCodeAsync(); // "310"
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
export declare function getMobileNetworkCodeAsync(): Promise<string | null>;
|