@capacitor/device 8.0.3-nightly-20260617T161850.0 → 9.0.0-alpha.1
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/Package.swift
CHANGED
|
@@ -10,14 +10,13 @@ let package = Package(
|
|
|
10
10
|
targets: ["DevicePlugin"])
|
|
11
11
|
],
|
|
12
12
|
dependencies: [
|
|
13
|
-
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "
|
|
13
|
+
.package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "9.0.0-alpha.0")
|
|
14
14
|
],
|
|
15
15
|
targets: [
|
|
16
16
|
.target(
|
|
17
17
|
name: "DevicePlugin",
|
|
18
18
|
dependencies: [
|
|
19
|
-
.product(name: "Capacitor", package: "capacitor-swift-pm")
|
|
20
|
-
.product(name: "Cordova", package: "capacitor-swift-pm")
|
|
19
|
+
.product(name: "Capacitor", package: "capacitor-swift-pm")
|
|
21
20
|
],
|
|
22
21
|
path: "ios/Sources/DevicePlugin"),
|
|
23
22
|
.testTarget(
|
package/README.md
CHANGED
|
@@ -124,26 +124,26 @@ Get the device's current language locale tag.
|
|
|
124
124
|
|
|
125
125
|
#### DeviceId
|
|
126
126
|
|
|
127
|
-
| Prop | Type | Description
|
|
128
|
-
| ---------------- | ------------------- |
|
|
129
|
-
| **`identifier`** | <code>string</code> | The identifier of the device as available to the app. This identifier may change on modern mobile platforms that only allow per-app install ids. On iOS, the identifier is a UUID that uniquely identifies a device to the app’s vendor ([read more](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor)). on Android
|
|
127
|
+
| Prop | Type | Description | Since |
|
|
128
|
+
| ---------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
|
|
129
|
+
| **`identifier`** | <code>string</code> | The identifier of the device as available to the app. This identifier may change on modern mobile platforms that only allow per-app install ids. On iOS, the identifier is a UUID that uniquely identifies a device to the app’s vendor ([read more](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor)). on Android, __the identifier is a 64-bit number (expressed as a hexadecimal string)__, unique to each combination of app-signing key, user, and device ([read more](https://developer.android.com/reference/android/provider/Settings.Secure#ANDROID_ID)). On web, a random identifier is generated and stored on localStorage for subsequent calls. If localStorage is not available a new random identifier will be generated on every call. | 1.0.0 |
|
|
130
130
|
|
|
131
131
|
|
|
132
132
|
#### DeviceInfo
|
|
133
133
|
|
|
134
|
-
| Prop | Type | Description
|
|
135
|
-
| ----------------------- | ----------------------------------------------------------- |
|
|
136
|
-
| **`name`** | <code>string</code> | The name of the device. For example, "John's iPhone". This is only supported on iOS and Android
|
|
137
|
-
| **`model`** | <code>string</code> | The device model. For example, "iPhone13,4".
|
|
138
|
-
| **`platform`** | <code>'ios' \| 'android' \| 'web'</code> | The device platform (lowercase).
|
|
139
|
-
| **`operatingSystem`** | <code><a href="#operatingsystem">OperatingSystem</a></code> | The operating system of the device.
|
|
140
|
-
| **`osVersion`** | <code>string</code> | The version of the device OS.
|
|
141
|
-
| **`iOSVersion`** | <code>number</code> | The iOS version number. Only available on iOS. Multi-part version numbers are crushed down into an integer padded to two-digits, ex: `"16.3.1"` -> `160301`
|
|
142
|
-
| **`androidSDKVersion`** | <code>number</code> | The Android SDK version number. Only available on Android.
|
|
143
|
-
| **`manufacturer`** | <code>string</code> | The manufacturer of the device.
|
|
144
|
-
| **`isVirtual`** | <code>boolean</code> | Whether the app is running in a simulator/emulator.
|
|
145
|
-
| **`memUsed`** | <code>number</code> | Approximate memory used by the current app, in bytes. Divide by 1048576 to get the number of MBs used.
|
|
146
|
-
| **`webViewVersion`** | <code>string</code> | The web view browser version
|
|
134
|
+
| Prop | Type | Description | Since |
|
|
135
|
+
| ----------------------- | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
|
|
136
|
+
| **`name`** | <code>string</code> | The name of the device. For example, "John's iPhone". This is only supported on iOS and Android. On iOS 16+ this will return a generic device name without the appropriate [entitlements](https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_device-information_user-assigned-device-name). | 1.0.0 |
|
|
137
|
+
| **`model`** | <code>string</code> | The device model. For example, "iPhone13,4". | 1.0.0 |
|
|
138
|
+
| **`platform`** | <code>'ios' \| 'android' \| 'web'</code> | The device platform (lowercase). | 1.0.0 |
|
|
139
|
+
| **`operatingSystem`** | <code><a href="#operatingsystem">OperatingSystem</a></code> | The operating system of the device. | 1.0.0 |
|
|
140
|
+
| **`osVersion`** | <code>string</code> | The version of the device OS. | 1.0.0 |
|
|
141
|
+
| **`iOSVersion`** | <code>number</code> | The iOS version number. Only available on iOS. Multi-part version numbers are crushed down into an integer padded to two-digits, ex: `"16.3.1"` -> `160301` | 5.0.0 |
|
|
142
|
+
| **`androidSDKVersion`** | <code>number</code> | The Android SDK version number. Only available on Android. | 5.0.0 |
|
|
143
|
+
| **`manufacturer`** | <code>string</code> | The manufacturer of the device. | 1.0.0 |
|
|
144
|
+
| **`isVirtual`** | <code>boolean</code> | Whether the app is running in a simulator/emulator. | 1.0.0 |
|
|
145
|
+
| **`memUsed`** | <code>number</code> | Approximate memory used by the current app, in bytes. Divide by 1048576 to get the number of MBs used. | 1.0.0 |
|
|
146
|
+
| **`webViewVersion`** | <code>string</code> | The web view browser version | 1.0.0 |
|
|
147
147
|
|
|
148
148
|
|
|
149
149
|
#### BatteryInfo
|
|
@@ -4,7 +4,6 @@ import android.content.Context;
|
|
|
4
4
|
import android.content.Intent;
|
|
5
5
|
import android.content.IntentFilter;
|
|
6
6
|
import android.content.pm.PackageInfo;
|
|
7
|
-
import android.content.pm.PackageManager;
|
|
8
7
|
import android.os.BatteryManager;
|
|
9
8
|
import android.os.Build;
|
|
10
9
|
import android.provider.Settings;
|
|
@@ -63,33 +62,14 @@ public class Device {
|
|
|
63
62
|
}
|
|
64
63
|
|
|
65
64
|
public String getName() {
|
|
66
|
-
|
|
67
|
-
return Settings.Global.getString(this.context.getContentResolver(), Settings.Global.DEVICE_NAME);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return null;
|
|
65
|
+
return Settings.Global.getString(this.context.getContentResolver(), Settings.Global.DEVICE_NAME);
|
|
71
66
|
}
|
|
72
67
|
|
|
73
68
|
public String getWebViewVersion() {
|
|
74
|
-
PackageInfo info =
|
|
75
|
-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
76
|
-
info = WebView.getCurrentWebViewPackage();
|
|
77
|
-
} else {
|
|
78
|
-
try {
|
|
79
|
-
info = getWebViewVersionSubAndroid26();
|
|
80
|
-
} catch (PackageManager.NameNotFoundException e) {
|
|
81
|
-
e.printStackTrace();
|
|
82
|
-
}
|
|
83
|
-
}
|
|
69
|
+
PackageInfo info = WebView.getCurrentWebViewPackage();
|
|
84
70
|
if (info != null) {
|
|
85
71
|
return info.versionName;
|
|
86
72
|
}
|
|
87
|
-
|
|
88
73
|
return Build.VERSION.RELEASE;
|
|
89
74
|
}
|
|
90
|
-
|
|
91
|
-
private PackageInfo getWebViewVersionSubAndroid26() throws PackageManager.NameNotFoundException {
|
|
92
|
-
PackageManager pm = this.context.getPackageManager();
|
|
93
|
-
return pm.getPackageInfo("com.android.chrome", 0);
|
|
94
|
-
}
|
|
95
75
|
}
|
package/dist/docs.json
CHANGED
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
"name": "since"
|
|
110
110
|
}
|
|
111
111
|
],
|
|
112
|
-
"docs": "The identifier of the device as available to the app. This identifier may change\non modern mobile platforms that only allow per-app install ids.\n\nOn iOS, the identifier is a UUID that uniquely identifies a device to the app’s vendor ([read more](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor)).\n\non Android
|
|
112
|
+
"docs": "The identifier of the device as available to the app. This identifier may change\non modern mobile platforms that only allow per-app install ids.\n\nOn iOS, the identifier is a UUID that uniquely identifies a device to the app’s vendor ([read more](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor)).\n\non Android, __the identifier is a 64-bit number (expressed as a hexadecimal string)__, unique to each combination of app-signing key, user, and device ([read more](https://developer.android.com/reference/android/provider/Settings.Secure#ANDROID_ID)).\n\nOn web, a random identifier is generated and stored on localStorage for subsequent calls.\nIf localStorage is not available a new random identifier will be generated on every call.",
|
|
113
113
|
"complexTypes": [],
|
|
114
114
|
"type": "string"
|
|
115
115
|
}
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
"name": "since"
|
|
131
131
|
}
|
|
132
132
|
],
|
|
133
|
-
"docs": "The name of the device. For example, \"John's iPhone\".\n\nThis is only supported on iOS and Android
|
|
133
|
+
"docs": "The name of the device. For example, \"John's iPhone\".\n\nThis is only supported on iOS and Android.\n\nOn iOS 16+ this will return a generic device name without the appropriate [entitlements](https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_device-information_user-assigned-device-name).",
|
|
134
134
|
"complexTypes": [],
|
|
135
135
|
"type": "string | undefined"
|
|
136
136
|
},
|
|
@@ -6,7 +6,7 @@ export interface DeviceId {
|
|
|
6
6
|
*
|
|
7
7
|
* On iOS, the identifier is a UUID that uniquely identifies a device to the app’s vendor ([read more](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor)).
|
|
8
8
|
*
|
|
9
|
-
* on Android
|
|
9
|
+
* on Android, __the identifier is a 64-bit number (expressed as a hexadecimal string)__, unique to each combination of app-signing key, user, and device ([read more](https://developer.android.com/reference/android/provider/Settings.Secure#ANDROID_ID)).
|
|
10
10
|
*
|
|
11
11
|
* On web, a random identifier is generated and stored on localStorage for subsequent calls.
|
|
12
12
|
* If localStorage is not available a new random identifier will be generated on every call.
|
|
@@ -19,7 +19,7 @@ export interface DeviceInfo {
|
|
|
19
19
|
/**
|
|
20
20
|
* The name of the device. For example, "John's iPhone".
|
|
21
21
|
*
|
|
22
|
-
* This is only supported on iOS and Android
|
|
22
|
+
* This is only supported on iOS and Android.
|
|
23
23
|
*
|
|
24
24
|
* On iOS 16+ this will return a generic device name without the appropriate [entitlements](https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_device-information_user-assigned-device-name).
|
|
25
25
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export type OperatingSystem = 'ios' | 'android' | 'windows' | 'mac' | 'unknown';\n\nexport interface DeviceId {\n /**\n * The identifier of the device as available to the app. This identifier may change\n * on modern mobile platforms that only allow per-app install ids.\n *\n * On iOS, the identifier is a UUID that uniquely identifies a device to the app’s vendor ([read more](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor)).\n *\n * on Android
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["export type OperatingSystem = 'ios' | 'android' | 'windows' | 'mac' | 'unknown';\n\nexport interface DeviceId {\n /**\n * The identifier of the device as available to the app. This identifier may change\n * on modern mobile platforms that only allow per-app install ids.\n *\n * On iOS, the identifier is a UUID that uniquely identifies a device to the app’s vendor ([read more](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor)).\n *\n * on Android, __the identifier is a 64-bit number (expressed as a hexadecimal string)__, unique to each combination of app-signing key, user, and device ([read more](https://developer.android.com/reference/android/provider/Settings.Secure#ANDROID_ID)).\n *\n * On web, a random identifier is generated and stored on localStorage for subsequent calls.\n * If localStorage is not available a new random identifier will be generated on every call.\n *\n * @since 1.0.0\n */\n identifier: string;\n}\n\nexport interface DeviceInfo {\n /**\n * The name of the device. For example, \"John's iPhone\".\n *\n * This is only supported on iOS and Android.\n *\n * On iOS 16+ this will return a generic device name without the appropriate [entitlements](https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_device-information_user-assigned-device-name).\n *\n * @since 1.0.0\n */\n name?: string;\n\n /**\n * The device model. For example, \"iPhone13,4\".\n *\n * @since 1.0.0\n */\n model: string;\n\n /**\n * The device platform (lowercase).\n *\n * @since 1.0.0\n */\n platform: 'ios' | 'android' | 'web';\n\n /**\n * The operating system of the device.\n *\n * @since 1.0.0\n */\n operatingSystem: OperatingSystem;\n\n /**\n * The version of the device OS.\n *\n * @since 1.0.0\n */\n osVersion: string;\n\n /**\n * The iOS version number.\n *\n * Only available on iOS.\n *\n * Multi-part version numbers are crushed down into an integer padded to two-digits, ex: `\"16.3.1\"` -> `160301`\n *\n * @since 5.0.0\n */\n iOSVersion?: number;\n\n /**\n * The Android SDK version number.\n *\n * Only available on Android.\n *\n * @since 5.0.0\n */\n androidSDKVersion?: number;\n\n /**\n * The manufacturer of the device.\n *\n * @since 1.0.0\n */\n manufacturer: string;\n\n /**\n * Whether the app is running in a simulator/emulator.\n *\n * @since 1.0.0\n */\n isVirtual: boolean;\n\n /**\n * Approximate memory used by the current app, in bytes. Divide by\n * 1048576 to get the number of MBs used.\n *\n * @since 1.0.0\n */\n memUsed?: number;\n\n /**\n * The web view browser version\n *\n * @since 1.0.0\n */\n webViewVersion: string;\n}\n\nexport interface BatteryInfo {\n /**\n * A percentage (0 to 1) indicating how much the battery is charged.\n *\n * @since 1.0.0\n */\n batteryLevel?: number;\n\n /**\n * Whether the device is charging.\n *\n * @since 1.0.0\n */\n isCharging?: boolean;\n}\n\nexport interface GetLanguageCodeResult {\n /**\n * Two character language code.\n *\n * @since 1.0.0\n */\n value: string;\n}\n\nexport interface LanguageTag {\n /**\n * Returns a well-formed IETF BCP 47 language tag.\n *\n * @since 4.0.0\n */\n value: string;\n}\n\nexport interface DevicePlugin {\n /**\n * Return an unique identifier for the device.\n *\n * @since 1.0.0\n */\n getId(): Promise<DeviceId>;\n\n /**\n * Return information about the underlying device/os/platform.\n *\n * @since 1.0.0\n */\n getInfo(): Promise<DeviceInfo>;\n\n /**\n * Return information about the battery.\n *\n * @since 1.0.0\n */\n getBatteryInfo(): Promise<BatteryInfo>;\n\n /**\n * Get the device's current language locale code.\n *\n * @since 1.0.0\n */\n getLanguageCode(): Promise<GetLanguageCodeResult>;\n\n /**\n * Get the device's current language locale tag.\n *\n * @since 4.0.0\n */\n getLanguageTag(): Promise<LanguageTag>;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capacitor/device",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0-alpha.1",
|
|
4
4
|
"description": "The Device API exposes internal information about the device, such as the model and operating system version, along with user information such as unique ids.",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
"publish:cocoapod": "pod trunk push ./CapacitorDevice.podspec --allow-warnings"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@capacitor/android": "
|
|
52
|
-
"@capacitor/core": "
|
|
51
|
+
"@capacitor/android": "next",
|
|
52
|
+
"@capacitor/core": "next",
|
|
53
53
|
"@capacitor/docgen": "0.3.0",
|
|
54
|
-
"@capacitor/ios": "
|
|
54
|
+
"@capacitor/ios": "next",
|
|
55
55
|
"@ionic/eslint-config": "^0.4.0",
|
|
56
56
|
"@ionic/prettier-config": "^4.0.0",
|
|
57
57
|
"@ionic/swiftlint-config": "^2.0.0",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"uvu": "^0.5.6"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@capacitor/core": ">=
|
|
69
|
+
"@capacitor/core": ">=9.0.0-alpha.0"
|
|
70
70
|
},
|
|
71
71
|
"prettier": "@ionic/prettier-config",
|
|
72
72
|
"swiftlint": "@ionic/swiftlint-config",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"publishConfig": {
|
|
85
85
|
"access": "public"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "39a501a5b7f0d671d86f58ed3dee2e2d1cfc890c"
|
|
88
88
|
}
|