Skip to content

Commit

Permalink
docs: add apple privacy manifest code requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
ItsChaceD committed Apr 10, 2024
1 parent 0ccb9c4 commit 18fc30c
Show file tree
Hide file tree
Showing 3 changed files with 179 additions and 140 deletions.
77 changes: 51 additions & 26 deletions device/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,44 @@ npm install @capacitor/device
npx cap sync
```

## Example
## Apple Privacy Manifest Requirements

Apple mandates that app developers now specify approved reasons for API usage to enhance user privacy. By May 1st, 2024, it's required to include these reasons when submitting apps to the App Store Connect.

When using this specific plugin in your app, you must create a `PrivacyInfo.xcprivacy` file in `/ios/App` or use the VS Code Extension to generate it, specifying the usage reasons.

### Manual Steps

1. In Xcode, select File > New File.
2. Choose App Privacy File type under the Resource section.
3. After creation, edit `PrivacyInfo.xcprivacy` to add the necessary keys and reasons, as detailed in [Apple's documentation](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files/describing_use_of_required_reason_api).

### Example PrivacyInfo.xcprivacy

```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyTracking</key>
<false/>
<key>NSPrivacyAccessedAPITypes</key>
<array>
<!-- Add this dict entry to the array if the PrivacyInfo file already exists -->
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryDiskSpace</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>85F4.1</string> <!-- Replace with the appropriate reason code -->
</array>
</dict>
</array>
</dict>
</plist>
```

## Example Plugin Usage

```typescript
import { Device } from '@capacitor/device';
Expand All @@ -31,13 +68,13 @@ const logBatteryInfo = async () => {

<docgen-index>

* [`getId()`](#getid)
* [`getInfo()`](#getinfo)
* [`getBatteryInfo()`](#getbatteryinfo)
* [`getLanguageCode()`](#getlanguagecode)
* [`getLanguageTag()`](#getlanguagetag)
* [Interfaces](#interfaces)
* [Type Aliases](#type-aliases)
- [`getId()`](#getid)
- [`getInfo()`](#getinfo)
- [`getBatteryInfo()`](#getbatteryinfo)
- [`getLanguageCode()`](#getlanguagecode)
- [`getLanguageTag()`](#getlanguagetag)
- [Interfaces](#interfaces)
- [Type Aliases](#type-aliases)

</docgen-index>

Expand All @@ -56,8 +93,7 @@ Return an unique identifier for the device.

**Since:** 1.0.0

--------------------

---

### getInfo()

Expand All @@ -71,8 +107,7 @@ Return information about the underlying device/os/platform.

**Since:** 1.0.0

--------------------

---

### getBatteryInfo()

Expand All @@ -86,8 +121,7 @@ Return information about the battery.

**Since:** 1.0.0

--------------------

---

### getLanguageCode()

Expand All @@ -101,8 +135,7 @@ Get the device's current language locale code.

**Since:** 1.0.0

--------------------

---

### getLanguageTag()

Expand All @@ -116,18 +149,15 @@ Get the device's current language locale tag.

**Since:** 4.0.0

--------------------

---

### Interfaces


#### DeviceId

| Prop | Type | Description | Since |
| ---------------- | ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
| **`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 8+, __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 |

| **`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 8+, **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 |

#### DeviceInfo

Expand All @@ -149,32 +179,27 @@ Get the device's current language locale tag.
| **`realDiskTotal`** | <code>number</code> | The total size of the normal data storage path, in bytes. | 1.1.0 |
| **`webViewVersion`** | <code>string</code> | The web view browser version | 1.0.0 |


#### BatteryInfo

| Prop | Type | Description | Since |
| ------------------ | -------------------- | ----------------------------------------------------------------- | ----- |
| **`batteryLevel`** | <code>number</code> | A percentage (0 to 1) indicating how much the battery is charged. | 1.0.0 |
| **`isCharging`** | <code>boolean</code> | Whether the device is charging. | 1.0.0 |


#### GetLanguageCodeResult

| Prop | Type | Description | Since |
| ----------- | ------------------- | ---------------------------- | ----- |
| **`value`** | <code>string</code> | Two character language code. | 1.0.0 |


#### LanguageTag

| Prop | Type | Description | Since |
| ----------- | ------------------- | ----------------------------------------------- | ----- |
| **`value`** | <code>string</code> | Returns a well-formed IETF BCP 47 language tag. | 4.0.0 |


### Type Aliases


#### OperatingSystem

<code>'ios' | 'android' | 'windows' | 'mac' | 'unknown'</code>
Expand Down
Loading

0 comments on commit 18fc30c

Please sign in to comment.