expo-device 5.0.0 → 5.2.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 CHANGED
@@ -10,6 +10,19 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 5.2.0 — 2023-02-03
14
+
15
+ ### 💡 Others
16
+
17
+ - On Android bump `compileSdkVersion` and `targetSdkVersion` to `33`. ([#20721](https://github.com/expo/expo/pull/20721) by [@lukmccall](https://github.com/lukmccall))
18
+
19
+ ## 5.1.0 — 2022-12-30
20
+
21
+ ### 🎉 New features
22
+
23
+ - Migrated Android codebase to use the new Expo modules API. ([#20118](https://github.com/expo/expo/pull/20118) by [@alanhughes](https://github.com/alanjhughes))
24
+ - Native module on iOS is now written in Swift using the Sweet API. ([#19526](https://github.com/expo/expo/pull/19526) by [@fobos531](https://github.com/fobos531))
25
+
13
26
  ## 5.0.0 — 2022-10-25
14
27
 
15
28
  ### 🛠 Breaking changes
package/README.md CHANGED
@@ -4,7 +4,7 @@ Provides specific information about the device running the application.
4
4
 
5
5
  # API documentation
6
6
 
7
- - [Documentation for the main branch](https://github.com/expo/expo/blob/main/docs/pages/versions/unversioned/sdk/device.md)
7
+ - [Documentation for the main branch](https://github.com/expo/expo/blob/main/docs/pages/versions/unversioned/sdk/device.mdx)
8
8
  - [Documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/device/)
9
9
 
10
10
  # Installation in managed Expo projects
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven-publish'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '5.0.0'
6
+ version = '5.2.0'
7
7
 
8
8
  buildscript {
9
9
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
@@ -59,7 +59,7 @@ afterEvaluate {
59
59
  }
60
60
 
61
61
  android {
62
- compileSdkVersion safeExtGet("compileSdkVersion", 31)
62
+ compileSdkVersion safeExtGet("compileSdkVersion", 33)
63
63
 
64
64
  compileOptions {
65
65
  sourceCompatibility JavaVersion.VERSION_11
@@ -72,9 +72,9 @@ android {
72
72
 
73
73
  defaultConfig {
74
74
  minSdkVersion safeExtGet("minSdkVersion", 21)
75
- targetSdkVersion safeExtGet("targetSdkVersion", 31)
75
+ targetSdkVersion safeExtGet("targetSdkVersion", 33)
76
76
  versionCode 12
77
- versionName '5.0.0'
77
+ versionName '5.2.0'
78
78
  }
79
79
  lintOptions {
80
80
  abortOnError false
@@ -1,12 +1,5 @@
1
1
  package expo.modules.device
2
2
 
3
- import expo.modules.core.ExportedModule
4
- import expo.modules.core.Promise
5
- import expo.modules.core.interfaces.ExpoMethod
6
- import expo.modules.core.utilities.EmulatorUtilities
7
-
8
- import com.facebook.device.yearclass.YearClass
9
-
10
3
  import android.app.ActivityManager
11
4
  import android.app.UiModeManager
12
5
  import android.content.Context
@@ -14,16 +7,20 @@ import android.content.res.Configuration
14
7
  import android.os.Build
15
8
  import android.os.SystemClock
16
9
  import android.provider.Settings
17
- import android.view.WindowManager
18
10
  import android.util.DisplayMetrics
19
-
11
+ import android.view.WindowManager
12
+ import com.facebook.device.yearclass.YearClass
13
+ import expo.modules.core.utilities.EmulatorUtilities
14
+ import expo.modules.kotlin.exception.Exceptions
15
+ import expo.modules.kotlin.modules.Module
16
+ import expo.modules.kotlin.modules.ModuleDefinition
20
17
  import java.io.File
21
18
  import kotlin.math.pow
22
19
  import kotlin.math.sqrt
23
20
 
24
21
  private const val NAME = "ExpoDevice"
25
22
 
26
- class DeviceModule(private val mContext: Context) : ExportedModule(mContext) {
23
+ class DeviceModule : Module() {
27
24
  // Keep this enum in sync with JavaScript
28
25
  enum class DeviceType(val JSValue: Int) {
29
26
  UNKNOWN(0),
@@ -33,78 +30,57 @@ class DeviceModule(private val mContext: Context) : ExportedModule(mContext) {
33
30
  TV(4);
34
31
  }
35
32
 
36
- override fun getName(): String {
37
- return NAME
38
- }
39
-
40
- override fun getConstants(): Map<String, Any> = mapOf(
41
- "isDevice" to !isRunningOnEmulator,
42
- "brand" to Build.BRAND,
43
- "manufacturer" to Build.MANUFACTURER,
44
- "modelName" to Build.MODEL,
45
- "designName" to Build.DEVICE,
46
- "productName" to Build.DEVICE,
47
- "deviceYearClass" to deviceYearClass,
48
- "totalMemory" to run {
49
- val memoryInfo = ActivityManager.MemoryInfo()
50
- (mContext.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager).getMemoryInfo(memoryInfo)
51
- memoryInfo.totalMem
52
- },
53
- "supportedCpuArchitectures" to run {
54
- var supportedAbis = Build.SUPPORTED_ABIS
55
- if (supportedAbis != null && supportedAbis.isEmpty()) {
56
- supportedAbis = null
57
- }
58
- supportedAbis
59
- },
60
- "osName" to systemName,
61
- "osVersion" to Build.VERSION.RELEASE,
62
- "osBuildId" to Build.DISPLAY,
63
- "osInternalBuildId" to Build.ID,
64
- "osBuildFingerprint" to Build.FINGERPRINT,
65
- "platformApiLevel" to Build.VERSION.SDK_INT,
66
- "deviceName" to run {
67
- if (Build.VERSION.SDK_INT <= 31)
68
- Settings.Secure.getString(mContext.contentResolver, "bluetooth_name")
69
- else
70
- Settings.Global.getString(mContext.contentResolver, Settings.Global.DEVICE_NAME)
71
- },
72
- )
73
-
74
- private val deviceYearClass: Int
75
- get() = YearClass.get(mContext)
76
-
77
- private val systemName: String
78
- get() {
79
- return if (Build.VERSION.SDK_INT < 23) {
80
- "Android"
81
- } else {
82
- Build.VERSION.BASE_OS.takeIf { it.isNotEmpty() } ?: "Android"
83
- }
33
+ private val context: Context
34
+ get() = appContext.reactContext ?: throw Exceptions.ReactContextLost()
35
+
36
+ override fun definition() = ModuleDefinition {
37
+ Name("ExpoDevice")
38
+
39
+ Constants {
40
+ return@Constants mapOf(
41
+ "isDevice" to !isRunningOnEmulator,
42
+ "brand" to Build.BRAND,
43
+ "manufacturer" to Build.MANUFACTURER,
44
+ "modelName" to Build.MODEL,
45
+ "designName" to Build.DEVICE,
46
+ "productName" to Build.DEVICE,
47
+ "deviceYearClass" to deviceYearClass,
48
+ "totalMemory" to run {
49
+ val memoryInfo = ActivityManager.MemoryInfo()
50
+ (context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager).getMemoryInfo(memoryInfo)
51
+ memoryInfo.totalMem
52
+ },
53
+ "supportedCpuArchitectures" to Build.SUPPORTED_ABIS?.takeIf { it.isNotEmpty() },
54
+ "osName" to systemName,
55
+ "osVersion" to Build.VERSION.RELEASE,
56
+ "osBuildId" to Build.DISPLAY,
57
+ "osInternalBuildId" to Build.ID,
58
+ "osBuildFingerprint" to Build.FINGERPRINT,
59
+ "platformApiLevel" to Build.VERSION.SDK_INT,
60
+ "deviceName" to if (Build.VERSION.SDK_INT <= 31)
61
+ Settings.Secure.getString(context.contentResolver, "bluetooth_name")
62
+ else
63
+ Settings.Global.getString(context.contentResolver, Settings.Global.DEVICE_NAME)
64
+ )
84
65
  }
85
66
 
86
- @ExpoMethod
87
- fun getDeviceTypeAsync(promise: Promise) {
88
- promise.resolve(getDeviceType(mContext).JSValue)
89
- }
67
+ AsyncFunction("getDeviceTypeAsync") {
68
+ return@AsyncFunction getDeviceType(context).JSValue
69
+ }
90
70
 
91
- @ExpoMethod
92
- fun getUptimeAsync(promise: Promise) {
93
- promise.resolve(SystemClock.uptimeMillis().toDouble())
94
- }
71
+ AsyncFunction("getUptimeAsync") {
72
+ return@AsyncFunction SystemClock.uptimeMillis().toDouble()
73
+ }
95
74
 
96
- @ExpoMethod
97
- fun getMaxMemoryAsync(promise: Promise) {
98
- val maxMemory = Runtime.getRuntime().maxMemory()
99
- promise.resolve(if (maxMemory != Long.MAX_VALUE) maxMemory.toDouble() else -1)
100
- }
75
+ AsyncFunction("getMaxMemoryAsync") {
76
+ val maxMemory = Runtime.getRuntime().maxMemory()
77
+ return@AsyncFunction if (maxMemory != Long.MAX_VALUE) maxMemory.toDouble() else -1
78
+ }
101
79
 
102
- @ExpoMethod
103
- fun isRootedExperimentalAsync(promise: Promise) {
104
- var isRooted = false
105
- val isDevice = !isRunningOnEmulator
80
+ AsyncFunction("isRootedExperimentalAsync") {
81
+ val isRooted: Boolean
82
+ val isDevice = !isRunningOnEmulator
106
83
 
107
- try {
108
84
  val buildTags = Build.TAGS
109
85
  isRooted = if (isDevice && buildTags != null && buildTags.contains("test-keys")) {
110
86
  true
@@ -115,44 +91,43 @@ class DeviceModule(private val mContext: Context) : ExportedModule(mContext) {
115
91
  isDevice && File("/system/xbin/su").exists()
116
92
  }
117
93
  }
118
- } catch (se: SecurityException) {
119
- promise.reject(
120
- "ERR_DEVICE_ROOT_DETECTION",
121
- "Could not access the file system to determine if the device is rooted.",
122
- se
123
- )
124
- return
94
+
95
+ return@AsyncFunction isRooted
125
96
  }
126
97
 
127
- promise.resolve(isRooted)
128
- }
98
+ AsyncFunction("isSideLoadingEnabledAsync") {
99
+ return@AsyncFunction if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
100
+ Settings.Global.getInt(
101
+ context.applicationContext.contentResolver,
102
+ Settings.Global.INSTALL_NON_MARKET_APPS,
103
+ 0
104
+ ) == 1
105
+ } else {
106
+ context.applicationContext.packageManager.canRequestPackageInstalls()
107
+ }
108
+ }
129
109
 
130
- @ExpoMethod
131
- fun isSideLoadingEnabledAsync(promise: Promise) {
132
- val enabled: Boolean = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
133
- Settings.Global.getInt(
134
- mContext.applicationContext.contentResolver,
135
- Settings.Global.INSTALL_NON_MARKET_APPS,
136
- 0
137
- ) == 1
138
- } else {
139
- mContext.applicationContext.packageManager.canRequestPackageInstalls()
110
+ AsyncFunction("getPlatformFeaturesAsync") {
111
+ val allFeatures = context.applicationContext.packageManager.systemAvailableFeatures
112
+ return@AsyncFunction allFeatures.filterNotNull().map { it.name }
140
113
  }
141
114
 
142
- promise.resolve(enabled)
115
+ AsyncFunction("hasPlatformFeatureAsync") { feature: String ->
116
+ return@AsyncFunction context.applicationContext.packageManager.hasSystemFeature(feature)
117
+ }
143
118
  }
144
119
 
145
- @ExpoMethod
146
- fun getPlatformFeaturesAsync(promise: Promise) {
147
- val allFeatures = mContext.applicationContext.packageManager.systemAvailableFeatures
148
- val featureList = allFeatures.filterNotNull().map { it.name }
149
- promise.resolve(featureList)
150
- }
120
+ private val deviceYearClass: Int
121
+ get() = YearClass.get(context)
151
122
 
152
- @ExpoMethod
153
- fun hasPlatformFeatureAsync(feature: String, promise: Promise) {
154
- promise.resolve(mContext.applicationContext.packageManager.hasSystemFeature(feature))
155
- }
123
+ private val systemName: String
124
+ get() {
125
+ return if (Build.VERSION.SDK_INT < 23) {
126
+ "Android"
127
+ } else {
128
+ Build.VERSION.BASE_OS.takeIf { it.isNotEmpty() } ?: "Android"
129
+ }
130
+ }
156
131
 
157
132
  companion object {
158
133
  private val TAG = DeviceModule::class.java.simpleName
@@ -172,7 +147,8 @@ class DeviceModule(private val mContext: Context) : ExportedModule(mContext) {
172
147
  }
173
148
 
174
149
  // Find the current window manager, if none is found we can't measure the device physical size.
175
- val windowManager = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager? ?: return DeviceType.UNKNOWN
150
+ val windowManager = context.getSystemService(Context.WINDOW_SERVICE) as WindowManager?
151
+ ?: return DeviceType.UNKNOWN
176
152
 
177
153
  // Get display metrics to see if we can differentiate phones and tablets.
178
154
  val metrics = DisplayMetrics()
@@ -182,7 +158,7 @@ class DeviceModule(private val mContext: Context) : ExportedModule(mContext) {
182
158
  val widthInches = metrics.widthPixels / metrics.xdpi.toDouble()
183
159
  val heightInches = metrics.heightPixels / metrics.ydpi.toDouble()
184
160
  val diagonalSizeInches = sqrt(widthInches.pow(2.0) + heightInches.pow(2.0))
185
- return if (diagonalSizeInches >= 3.0 && diagonalSizeInches <= 6.9) {
161
+ return if (diagonalSizeInches in 3.0..6.9) {
186
162
  // Devices in a sane range for phones are considered to be phones.
187
163
  DeviceType.PHONE
188
164
  } else if (diagonalSizeInches > 6.9 && diagonalSizeInches <= 18.0) {
package/build/Device.d.ts CHANGED
@@ -1,27 +1,277 @@
1
1
  import { DeviceType } from './Device.types';
2
2
  export { DeviceType };
3
+ /**
4
+ * `true` if the app is running on a real device and `false` if running in a simulator or emulator.
5
+ * On web, this is always set to `true`.
6
+ */
3
7
  export declare const isDevice: boolean;
8
+ /**
9
+ * The device brand. The consumer-visible brand of the product/hardware. On web, this value is always `null`.
10
+ *
11
+ * @example
12
+ * ```js
13
+ * Device.brand; // Android: "google", "xiaomi"; iOS: "Apple"; web: null
14
+ * ```
15
+ * @platform android
16
+ * @platform ios
17
+ */
4
18
  export declare const brand: string | null;
19
+ /**
20
+ * The actual device manufacturer of the product or hardware. This value of this field may be `null` if it cannot be determined.
21
+ *
22
+ * To view difference between `brand` and `manufacturer` on Android see [official documentation](https://developer.android.com/reference/android/os/Build).
23
+ *
24
+ * @example
25
+ * ```js
26
+ * Device.manufacturer; // Android: "Google", "xiaomi"; iOS: "Apple"; web: "Google", null
27
+ * ```
28
+ */
5
29
  export declare const manufacturer: string | null;
30
+ /**
31
+ * The internal model ID of the device. This is useful for programmatically identifying the type of device and is not a human-friendly string.
32
+ * On web and Android, this value is always `null`.
33
+ *
34
+ * @example
35
+ * ```js
36
+ * Device.modelId; // iOS: "iPhone7,2"; Android: null; web: null
37
+ * ```
38
+ * @platform ios
39
+ */
6
40
  export declare const modelId: any;
41
+ /**
42
+ * The human-friendly name of the device model. This is the name that people would typically use to refer to the device rather than a programmatic model identifier.
43
+ * This value of this field may be `null` if it cannot be determined.
44
+ *
45
+ * @example
46
+ * ```js
47
+ * Device.modelName; // Android: "Pixel 2"; iOS: "iPhone XS Max"; web: "iPhone", null
48
+ * ```
49
+ */
7
50
  export declare const modelName: string | null;
51
+ /**
52
+ * The specific configuration or name of the industrial design. It represents the device's name when it was designed during manufacturing into mass production.
53
+ * On Android, it corresponds to [`Build.DEVICE`](https://developer.android.com/reference/android/os/Build#DEVICE). On web and iOS, this value is always `null`.
54
+ *
55
+ * @example
56
+ * ```js
57
+ * Device.designName; // Android: "kminilte"; iOS: null; web: null
58
+ * ```
59
+ * @platform android
60
+ */
8
61
  export declare const designName: string | null;
62
+ /**
63
+ * The device's overall product name chosen by the device implementer containing the development name or code name of the device.
64
+ * Corresponds to [`Build.PRODUCT`](https://developer.android.com/reference/android/os/Build#PRODUCT). On web and iOS, this value is always `null`.
65
+ *
66
+ * @example
67
+ * ```js
68
+ * Device.productName; // Android: "kminiltexx"; iOS: null; web: null
69
+ * ```
70
+ * @platform android
71
+ */
9
72
  export declare const productName: string | null;
73
+ /**
74
+ * The [device year class](https://github.com/facebook/device-year-class) of this device. On web, this value is always `null`.
75
+ */
10
76
  export declare const deviceYearClass: number | null;
77
+ /**
78
+ * The device's total memory, in bytes. This is the total memory accessible to the kernel, but not necessarily to a single app.
79
+ * This is basically the amount of RAM the device has, not including below-kernel fixed allocations like DMA buffers, RAM for the baseband CPU, etc…
80
+ * On web, this value is always `null`.
81
+ *
82
+ * @example
83
+ * ```js
84
+ * Device.totalMemory; // 17179869184
85
+ * ```
86
+ */
11
87
  export declare const totalMemory: number | null;
88
+ /**
89
+ * A list of supported processor architecture versions. The device expects the binaries it runs to be compiled for one of these architectures.
90
+ * This value is `null` if the supported architectures could not be determined, particularly on web.
91
+ *
92
+ * @example
93
+ * ```js
94
+ * Device.supportedCpuArchitectures; // ['arm64 v8', 'Intel x86-64h Haswell', 'arm64-v8a', 'armeabi-v7a", 'armeabi']
95
+ * ```
96
+ */
12
97
  export declare const supportedCpuArchitectures: string[] | null;
98
+ /**
99
+ * The name of the OS running on the device.
100
+ *
101
+ * @example
102
+ * ```js
103
+ * Device.osName; // Android: "Android"; iOS: "iOS" or "iPadOS"; web: "iOS", "Android", "Windows"
104
+ * ```
105
+ */
13
106
  export declare const osName: string | null;
107
+ /**
108
+ * The human-readable OS version string. Note that the version string may not always contain three numbers separated by dots.
109
+ *
110
+ * @example
111
+ * ```js
112
+ * Device.osVersion; // Android: "4.0.3"; iOS: "12.3.1"; web: "11.0", "8.1.0"
113
+ * ```
114
+ */
14
115
  export declare const osVersion: string | null;
116
+ /**
117
+ * The build ID of the OS that more precisely identifies the version of the OS. On Android, this corresponds to `Build.DISPLAY` (not `Build.ID`)
118
+ * and currently is a string as described [here](https://source.android.com/setup/start/build-numbers). On iOS, this corresponds to `kern.osversion`
119
+ * and is the detailed OS version sometimes displayed next to the more human-readable version. On web, this value is always `null`.
120
+ *
121
+ * @example
122
+ * ```js
123
+ * Device.osBuildId; // Android: "PSR1.180720.075"; iOS: "16F203"; web: null
124
+ * ```
125
+ */
15
126
  export declare const osBuildId: string | null;
127
+ /**
128
+ * The internal build ID of the OS running on the device. On Android, this corresponds to `Build.ID`.
129
+ * On iOS, this is the same value as [`Device.osBuildId`](#deviceosbuildid). On web, this value is always `null`.
130
+ *
131
+ * @example
132
+ * ```js
133
+ * Device.osInternalBuildId; // Android: "MMB29K"; iOS: "16F203"; web: null,
134
+ * ```
135
+ */
16
136
  export declare const osInternalBuildId: string | null;
137
+ /**
138
+ * A string that uniquely identifies the build of the currently running system OS. On Android, it follows this template:
139
+ * - `$(BRAND)/$(PRODUCT)/$(DEVICE)/$(BOARD):$(VERSION.RELEASE)/$(ID)/$(VERSION.INCREMENTAL):$(TYPE)/\$(TAGS)`
140
+ * On web and iOS, this value is always `null`.
141
+ *
142
+ * @example
143
+ * ```js
144
+ * Device.osBuildFingerprint;
145
+ * // Android: "google/sdk_gphone_x86/generic_x86:9/PSR1.180720.075/5124027:user/release-keys";
146
+ * // iOS: null; web: null
147
+ * ```
148
+ * @platform android
149
+ */
17
150
  export declare const osBuildFingerprint: string | null;
151
+ /**
152
+ * The Android SDK version of the software currently running on this hardware device. This value never changes while a device is booted,
153
+ * but it may increase when the hardware manufacturer provides an OS update. See [here](https://developer.android.com/reference/android/os/Build.VERSION_CODES.html)
154
+ * to see all possible version codes and corresponding versions. On iOS and web, this value is always `null`.
155
+ *
156
+ * @example
157
+ * ```js
158
+ * Device.platformApiLevel; // Android: 19; iOS: null; web: null
159
+ * ```
160
+ * @platform android
161
+ */
18
162
  export declare const platformApiLevel: number | null;
163
+ /**
164
+ * The human-readable name of the device, which may be set by the device's user. If the device name is unavailable, particularly on web, this value is `null`.
165
+ *
166
+ * > On iOS 16 and newer, this value will be set to generic "iPhone" until you add the correct entitlement, see [iOS Capabilities page](/build-reference/ios-capabilities)
167
+ * > to learn how to add one and check out [Apple documentation](https://developer.apple.com/documentation/uikit/uidevice/1620015-name#discussion)
168
+ * > for more details on this change.
169
+ *
170
+ * @example
171
+ * ```js
172
+ * Device.deviceName; // "Vivian's iPhone XS"
173
+ * ```
174
+ */
19
175
  export declare const deviceName: string | null;
176
+ /**
177
+ * Checks the type of the device as a [`DeviceType`](#devicetype) enum value.
178
+ *
179
+ * On Android, for devices other than TVs, the device type is determined by the screen resolution (screen diagonal size), so the result may not be completely accurate.
180
+ * If the screen diagonal length is between 3" and 6.9", the method returns `DeviceType.PHONE`. For lengths between 7" and 18", the method returns `DeviceType.TABLET`.
181
+ * Otherwise, the method returns `DeviceType.UNKNOWN`.
182
+ *
183
+ * @return Returns a promise that resolves to a [`DeviceType`](#devicetype) enum value.
184
+ * @example
185
+ * ```js
186
+ * await Device.getDeviceTypeAsync();
187
+ * // DeviceType.PHONE
188
+ * ```
189
+ */
20
190
  export declare function getDeviceTypeAsync(): Promise<DeviceType>;
191
+ /**
192
+ * Gets the uptime since the last reboot of the device, in milliseconds. Android devices do not count time spent in deep sleep.
193
+ * @return Returns a promise that resolves to a `number` that represents the milliseconds since last reboot.
194
+ * @example
195
+ * ```js
196
+ * await Device.getUptimeAsync();
197
+ * // 4371054
198
+ * ```
199
+ * @platform android
200
+ * @platform ios
201
+ */
21
202
  export declare function getUptimeAsync(): Promise<number>;
203
+ /**
204
+ * Returns the maximum amount of memory that the Java VM will attempt to use. If there is no inherent limit then `Number.MAX_SAFE_INTEGER` is returned.
205
+ * @return Returns a promise that resolves to the maximum available memory that the Java VM will use, in bytes.
206
+ * @example
207
+ * ```js
208
+ * await Device.getMaxMemoryAsync();
209
+ * // 402653184
210
+ * ```
211
+ * @platform android
212
+ */
22
213
  export declare function getMaxMemoryAsync(): Promise<number>;
214
+ /**
215
+ * > **warning** This method is experimental and is not completely reliable. See description below.
216
+ *
217
+ * Checks whether the device has been rooted (Android) or jailbroken (iOS). This is not completely reliable because there exist solutions to bypass root-detection
218
+ * on both [iOS](https://www.theiphonewiki.com/wiki/XCon) and [Android](https://tweakerlinks.com/how-to-bypass-apps-root-detection-in-android-device/).
219
+ * Further, many root-detection checks can be bypassed via reverse engineering.
220
+ * - On Android, it's implemented in a way to find all possible files paths that contain the `"su"` executable but some devices that are not rooted may also have this executable. Therefore, there's no guarantee that this method will always return correctly.
221
+ * - On iOS, [these jailbreak checks](https://www.theiphonewiki.com/wiki/Bypassing_Jailbreak_Detection) are used to detect if a device is rooted/jailbroken. However, since there are closed-sourced solutions such as [xCon](https://www.theiphonewiki.com/wiki/XCon) that aim to hook every known method and function responsible for informing an application of a jailbroken device, this method may not reliably detect devices that have xCon or similar packages installed.
222
+ * - On web, this always resolves to `false` even if the device is rooted.
223
+ * @return Returns a promise that resolves to a `boolean` that specifies whether this device is rooted.
224
+ * @example
225
+ * ```js
226
+ * await Device.isRootedExperimentalAsync();
227
+ * // true or false
228
+ * ```
229
+ */
23
230
  export declare function isRootedExperimentalAsync(): Promise<boolean>;
231
+ /**
232
+ * **Using this method requires you to [add the `REQUEST_INSTALL_PACKAGES` permission](/config/app#permissions).**
233
+ * Returns whether applications can be installed for this user via the system's [Intent#ACTION_INSTALL_PACKAGE](https://developer.android.com/reference/android/content/Intent.html#ACTION_INSTALL_PACKAGE)
234
+ * mechanism rather than through the OS's default app store, like Google Play.
235
+ * @return Returns a promise that resolves to a `boolean` that represents whether the calling package is allowed to request package installation.
236
+ * @example
237
+ * ```js
238
+ * await Device.isSideLoadingEnabledAsync();
239
+ * // true or false
240
+ * ```
241
+ * @platform android
242
+ */
24
243
  export declare function isSideLoadingEnabledAsync(): Promise<boolean>;
244
+ /**
245
+ * Gets a list of features that are available on the system. The feature names are platform-specific.
246
+ * See [Android documentation](<https://developer.android.com/reference/android/content/pm/PackageManager#getSystemAvailableFeatures()>)
247
+ * to learn more about this implementation.
248
+ * @return Returns a promise that resolves to an array of strings, each of which is a platform-specific name of a feature available on the current device.
249
+ * On iOS and web, the promise always resolves to an empty array.
250
+ * @example
251
+ * ```js
252
+ * await Device.getPlatformFeaturesAsync();
253
+ * // [
254
+ * // 'android.software.adoptable_storage',
255
+ * // 'android.software.backup',
256
+ * // 'android.hardware.sensor.accelerometer',
257
+ * // 'android.hardware.touchscreen',
258
+ * // ]
259
+ * ```
260
+ * @platform android
261
+ */
25
262
  export declare function getPlatformFeaturesAsync(): Promise<string[]>;
263
+ /**
264
+ * Tells if the device has a specific system feature.
265
+ * @param feature The platform-specific name of the feature to check for on the device. You can get all available system features with `Device.getSystemFeatureAsync()`.
266
+ * See [Android documentation](<https://developer.android.com/reference/android/content/pm/PackageManager#hasSystemFeature(java.lang.String)>) to view acceptable feature strings.
267
+ * @return Returns a promise that resolves to a boolean value indicating whether the device has the specified system feature.
268
+ * On iOS and web, the promise always resolves to `false`.
269
+ * @example
270
+ * ```js
271
+ * await Device.hasPlatformFeatureAsync('amazon.hardware.fire_tv');
272
+ * // true or false
273
+ * ```
274
+ * @platform android
275
+ */
26
276
  export declare function hasPlatformFeatureAsync(feature: string): Promise<boolean>;
27
277
  //# sourceMappingURL=Device.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Device.d.ts","sourceRoot":"","sources":["../src/Device.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG5C,OAAO,EAAE,UAAU,EAAE,CAAC;AAEtB,eAAO,MAAM,QAAQ,EAAE,OAAiD,CAAC;AACzE,eAAO,MAAM,KAAK,EAAE,MAAM,GAAG,IAA2C,CAAC;AACzE,eAAO,MAAM,YAAY,EAAE,MAAM,GAAG,IAAkD,CAAC;AACvF,eAAO,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