|
| 1 | +## Privacy / GDPR |
| 2 | + |
| 3 | +It is up to you as the developer to choose how and if to be GDPR-compliant with your application. |
| 4 | +We provide the following tools to help you implement privacy controls when needed. |
| 5 | + |
| 6 | +From an end-user perspective, CodePush's core functionality of checking for and applying updates can be considered essential to the app's operation, as it ensures users receive bug fixes and improvements. |
| 7 | +However, the telemetry features that collect usage data to provide you with deployment analytics might be considered non-essential from a privacy standpoint and could require explicit user consent under privacy regulations like GDPR. |
| 8 | + |
| 9 | +- [Data transmission](#data-transmission) |
| 10 | +- [Telemetry](#telemetry) |
| 11 | + |
| 12 | +### Data transmission |
| 13 | + |
| 14 | +By default, CodePush connects to the server to check for updates or for other API calls. |
| 15 | + |
| 16 | +If you need to make it opt in or provide users with the ability to opt out of this behavior, you can use the data transmission controls. |
| 17 | + |
| 18 | +#### Disabling data transmission by default (opt in) |
| 19 | + |
| 20 | +You can disable data transmission by default by configuring your native app: |
| 21 | + |
| 22 | +**Android:** |
| 23 | + |
| 24 | +Add this to your `android/app/build.gradle` file: |
| 25 | + |
| 26 | +```groovy |
| 27 | +android { |
| 28 | + // ... |
| 29 | + defaultConfig { |
| 30 | + // ... |
| 31 | + resValue "bool", "CodePushDefaultDataTransmissionEnabled", "false" |
| 32 | + } |
| 33 | +} |
| 34 | +``` |
| 35 | + |
| 36 | +**iOS:** |
| 37 | + |
| 38 | +Add this to your `ios/YourApp/Info.plist` file: |
| 39 | + |
| 40 | +``` |
| 41 | +<key>CodePushDefaultDataTransmissionEnabled</key> |
| 42 | +<false/> |
| 43 | +``` |
| 44 | + |
| 45 | +#### Managing data transmission during runtime |
| 46 | + |
| 47 | +You can also programmatically check or change data transmission status during app runtime. |
| 48 | +This will persist across app sessions. |
| 49 | + |
| 50 | +If you enable data transmission when it was disabled, checking for updates will work again immediately but if your app usually checks for update on app start, the next check will be on app start. You may want to call `sync` manually after resuming data transmission. We don't do this automatically to make things atomic and for the flexibility of the sync options. |
| 51 | + |
| 52 | +```typescript |
| 53 | +import * as CodePush from '@appzung/react-native-code-push'; |
| 54 | + |
| 55 | +// Check if data transmission is enabled |
| 56 | +CodePush.getDataTransmissionEnabled().then((enabled) => { |
| 57 | + console.log('Data transmission is ' + (enabled ? 'enabled' : 'disabled')); |
| 58 | +}); |
| 59 | + |
| 60 | +// Enable data transmission |
| 61 | +CodePush.setDataTransmissionEnabled(true); |
| 62 | + |
| 63 | +// Disable data transmission |
| 64 | +CodePush.setDataTransmissionEnabled(false); |
| 65 | +``` |
| 66 | + |
| 67 | +When data transmission is disabled, the CodePush client will not connect to the server to check for updates or for any other API calls. |
| 68 | + |
| 69 | +### Telemetry |
| 70 | + |
| 71 | +CodePush collects anonymous usage data by default for reporting downloads and installs (to provide you with analytics). |
| 72 | +You may want to disable this telemetry collection for privacy regulations or user preferences. |
| 73 | + |
| 74 | +#### Disabling telemetry by default (opt in) |
| 75 | + |
| 76 | +You can disable telemetry by default by configuring your native app: |
| 77 | + |
| 78 | +**Android:** |
| 79 | + |
| 80 | +Add this to your `android/app/build.gradle` file: |
| 81 | + |
| 82 | +```groovy |
| 83 | +android { |
| 84 | + // ... |
| 85 | + defaultConfig { |
| 86 | + // ... |
| 87 | + resValue "bool", "CodePushDefaultTelemetryEnabled", "false" |
| 88 | + } |
| 89 | +} |
| 90 | +``` |
| 91 | + |
| 92 | +**iOS:** |
| 93 | + |
| 94 | +Add this to your `ios/YourApp/Info.plist` file: |
| 95 | + |
| 96 | +``` |
| 97 | +<key>CodePushDefaultTelemetryEnabled</key> |
| 98 | +<false/> |
| 99 | +``` |
| 100 | + |
| 101 | +#### Managing telemetry during runtime |
| 102 | + |
| 103 | +You can also programmatically check or change telemetry status during app runtime. |
| 104 | +This will persist across app sessions. |
| 105 | + |
| 106 | +```typescript |
| 107 | +import * as CodePush from '@appzung/react-native-code-push'; |
| 108 | + |
| 109 | +// Check if telemetry is enabled |
| 110 | +CodePush.getTelemetryEnabled().then((enabled) => { |
| 111 | + console.log('Telemetry is ' + (enabled ? 'enabled' : 'disabled')); |
| 112 | +}); |
| 113 | + |
| 114 | +// Enable telemetry |
| 115 | +CodePush.setTelemetryEnabled(true); |
| 116 | + |
| 117 | +// Disable telemetry |
| 118 | +CodePush.setTelemetryEnabled(false); |
| 119 | +``` |
0 commit comments