native-update 1.0.0 → 1.0.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.
Files changed (55) hide show
  1. package/{CapacitorNativeUpdate.podspec → NativeUpdate.podspec} +1 -1
  2. package/Readme.md +16 -16
  3. package/android/src/main/java/com/aoneahsan/nativeupdate/{CapacitorNativeUpdatePlugin.kt → NativeUpdatePlugin.kt} +2 -2
  4. package/dist/esm/core/errors.d.ts +6 -6
  5. package/dist/esm/core/errors.js +8 -8
  6. package/dist/esm/core/errors.js.map +1 -1
  7. package/dist/esm/core/logger.js +1 -1
  8. package/dist/esm/core/logger.js.map +1 -1
  9. package/dist/esm/core/plugin-manager.js +3 -3
  10. package/dist/esm/core/plugin-manager.js.map +1 -1
  11. package/dist/esm/definitions.d.ts +12 -14
  12. package/dist/esm/definitions.js +1 -0
  13. package/dist/esm/definitions.js.map +1 -1
  14. package/dist/esm/index.d.ts +3 -3
  15. package/dist/esm/index.js +2 -2
  16. package/dist/esm/index.js.map +1 -1
  17. package/dist/esm/plugin.d.ts +3 -3
  18. package/dist/esm/plugin.js +13 -13
  19. package/dist/esm/plugin.js.map +1 -1
  20. package/dist/esm/web.d.ts +0 -1
  21. package/dist/esm/web.js +3 -3
  22. package/dist/esm/web.js.map +1 -1
  23. package/dist/plugin.cjs.js +1 -1
  24. package/dist/plugin.cjs.js.map +1 -1
  25. package/dist/plugin.esm.js +1 -1
  26. package/dist/plugin.esm.js.map +1 -1
  27. package/dist/plugin.js +2 -2
  28. package/dist/plugin.js.map +1 -1
  29. package/docs/APP_REVIEW_GUIDE.md +12 -12
  30. package/docs/BUNDLE_SIGNING.md +4 -4
  31. package/docs/LIVE_UPDATES_GUIDE.md +48 -48
  32. package/docs/MIGRATION.md +10 -10
  33. package/docs/NATIVE_UPDATES_GUIDE.md +25 -25
  34. package/docs/QUICK_START.md +34 -34
  35. package/docs/README.md +5 -5
  36. package/docs/api/app-review-api.md +15 -15
  37. package/docs/api/app-update-api.md +18 -18
  38. package/docs/api/events-api.md +23 -23
  39. package/docs/api/live-update-api.md +20 -20
  40. package/docs/background-updates.md +18 -18
  41. package/docs/examples/advanced-scenarios.md +27 -27
  42. package/docs/examples/basic-usage.md +17 -17
  43. package/docs/features/app-reviews.md +13 -13
  44. package/docs/features/app-updates.md +21 -21
  45. package/docs/features/live-updates.md +32 -32
  46. package/docs/getting-started/configuration.md +8 -8
  47. package/docs/getting-started/installation.md +4 -4
  48. package/docs/getting-started/quick-start.md +28 -28
  49. package/docs/guides/deployment-guide.md +2 -2
  50. package/docs/guides/migration-from-codepush.md +5 -5
  51. package/docs/guides/testing-guide.md +17 -17
  52. package/docs/security/certificate-pinning.md +2 -2
  53. package/ios/Plugin/{CapacitorNativeUpdatePlugin.m → NativeUpdatePlugin.m} +1 -1
  54. package/package.json +2 -2
  55. /package/ios/Plugin/{CapacitorNativeUpdatePlugin.swift → NativeUpdatePlugin.swift} +0 -0
@@ -9,7 +9,7 @@ Complete API documentation for native app store update functionality.
9
9
  Check if a native app update is available in the app store.
10
10
 
11
11
  ```typescript
12
- const result = await CapacitorNativeUpdate.checkAppUpdate();
12
+ const result = await NativeUpdate.checkAppUpdate();
13
13
  // Returns:
14
14
  {
15
15
  updateAvailable: boolean;
@@ -35,7 +35,7 @@ Start an immediate (blocking) update. Android only - shows full-screen update UI
35
35
 
36
36
  ```typescript
37
37
  try {
38
- await CapacitorNativeUpdate.startImmediateUpdate();
38
+ await NativeUpdate.startImmediateUpdate();
39
39
  // App will restart after update
40
40
  } catch (error) {
41
41
  // User cancelled or update failed
@@ -47,7 +47,7 @@ try {
47
47
  Start a flexible (background) update. Android only - downloads in background.
48
48
 
49
49
  ```typescript
50
- await CapacitorNativeUpdate.startFlexibleUpdate();
50
+ await NativeUpdate.startFlexibleUpdate();
51
51
  // Monitor progress with appUpdateProgress event
52
52
  ```
53
53
 
@@ -56,7 +56,7 @@ await CapacitorNativeUpdate.startFlexibleUpdate();
56
56
  Complete a flexible update installation. Android only.
57
57
 
58
58
  ```typescript
59
- await CapacitorNativeUpdate.completeFlexibleUpdate();
59
+ await NativeUpdate.completeFlexibleUpdate();
60
60
  // App will restart
61
61
  ```
62
62
 
@@ -65,7 +65,7 @@ await CapacitorNativeUpdate.completeFlexibleUpdate();
65
65
  Get detailed version information.
66
66
 
67
67
  ```typescript
68
- const info = await CapacitorNativeUpdate.getVersionInfo();
68
+ const info = await NativeUpdate.getVersionInfo();
69
69
  // Returns:
70
70
  {
71
71
  currentVersion: string; // e.g., "1.2.3"
@@ -82,7 +82,7 @@ const info = await CapacitorNativeUpdate.getVersionInfo();
82
82
  Check if the app meets minimum version requirements.
83
83
 
84
84
  ```typescript
85
- const result = await CapacitorNativeUpdate.isMinimumVersionMet();
85
+ const result = await NativeUpdate.isMinimumVersionMet();
86
86
  // Returns:
87
87
  {
88
88
  isMet: boolean;
@@ -97,7 +97,7 @@ const result = await CapacitorNativeUpdate.isMinimumVersionMet();
97
97
  Open the app store page for updates.
98
98
 
99
99
  ```typescript
100
- await CapacitorNativeUpdate.openAppStore();
100
+ await NativeUpdate.openAppStore();
101
101
  ```
102
102
 
103
103
  ### getAppStoreUrl()
@@ -105,7 +105,7 @@ await CapacitorNativeUpdate.openAppStore();
105
105
  Get the app store URL without opening it.
106
106
 
107
107
  ```typescript
108
- const result = await CapacitorNativeUpdate.getAppStoreUrl();
108
+ const result = await NativeUpdate.getAppStoreUrl();
109
109
  // Returns:
110
110
  {
111
111
  url: string; // e.g., "https://apps.apple.com/app/id123456789"
@@ -118,7 +118,7 @@ const result = await CapacitorNativeUpdate.getAppStoreUrl();
118
118
  Get the current install state of a flexible update. Android only.
119
119
 
120
120
  ```typescript
121
- const state = await CapacitorNativeUpdate.getUpdateInstallState();
121
+ const state = await NativeUpdate.getUpdateInstallState();
122
122
  // Returns:
123
123
  {
124
124
  installStatus: number; // Android InstallStatus code
@@ -135,7 +135,7 @@ const state = await CapacitorNativeUpdate.getUpdateInstallState();
135
135
  Fired when app update state changes. Android only.
136
136
 
137
137
  ```typescript
138
- CapacitorNativeUpdate.addListener('appUpdateStateChanged', (state) => {
138
+ NativeUpdate.addListener('appUpdateStateChanged', (state) => {
139
139
  console.log('Install status:', state.installStatus);
140
140
  // InstallStatus codes:
141
141
  // 0: Unknown
@@ -154,7 +154,7 @@ CapacitorNativeUpdate.addListener('appUpdateStateChanged', (state) => {
154
154
  Fired during flexible update download. Android only.
155
155
 
156
156
  ```typescript
157
- CapacitorNativeUpdate.addListener('appUpdateProgress', (progress) => {
157
+ NativeUpdate.addListener('appUpdateProgress', (progress) => {
158
158
  console.log(`Downloaded: ${progress.bytesDownloaded}/${progress.totalBytesToDownload}`);
159
159
  console.log(`Progress: ${progress.percentComplete}%`);
160
160
  });
@@ -200,9 +200,9 @@ CapacitorNativeUpdate.addListener('appUpdateProgress', (progress) => {
200
200
  1. **Check for updates on app start**
201
201
  ```typescript
202
202
  async function checkOnStart() {
203
- const result = await CapacitorNativeUpdate.checkAppUpdate();
203
+ const result = await NativeUpdate.checkAppUpdate();
204
204
  if (result.updateAvailable && result.updatePriority === 'IMMEDIATE') {
205
- await CapacitorNativeUpdate.startImmediateUpdate();
205
+ await NativeUpdate.startImmediateUpdate();
206
206
  }
207
207
  }
208
208
  ```
@@ -210,15 +210,15 @@ CapacitorNativeUpdate.addListener('appUpdateProgress', (progress) => {
210
210
  2. **Handle flexible updates**
211
211
  ```typescript
212
212
  // Start download
213
- await CapacitorNativeUpdate.startFlexibleUpdate();
213
+ await NativeUpdate.startFlexibleUpdate();
214
214
 
215
215
  // Monitor progress
216
- const listener = CapacitorNativeUpdate.addListener('appUpdateProgress', (progress) => {
216
+ const listener = NativeUpdate.addListener('appUpdateProgress', (progress) => {
217
217
  updateProgressBar(progress.percentComplete);
218
218
  });
219
219
 
220
220
  // Complete when ready
221
- const stateListener = CapacitorNativeUpdate.addListener('appUpdateStateChanged', (state) => {
221
+ const stateListener = NativeUpdate.addListener('appUpdateStateChanged', (state) => {
222
222
  if (state.installStatus === 11) { // Downloaded
223
223
  showUpdateReadyPrompt();
224
224
  }
@@ -228,10 +228,10 @@ CapacitorNativeUpdate.addListener('appUpdateProgress', (progress) => {
228
228
  3. **Fallback for iOS**
229
229
  ```typescript
230
230
  if (platform === 'ios') {
231
- const result = await CapacitorNativeUpdate.checkAppUpdate();
231
+ const result = await NativeUpdate.checkAppUpdate();
232
232
  if (result.updateAvailable) {
233
233
  showUpdateDialog(() => {
234
- CapacitorNativeUpdate.openAppStore();
234
+ NativeUpdate.openAppStore();
235
235
  });
236
236
  }
237
237
  }
@@ -8,7 +8,7 @@ Complete documentation for all events emitted by the Capacitor Native Update plu
8
8
 
9
9
  ```typescript
10
10
  // Add a listener
11
- const listener = CapacitorNativeUpdate.addListener('eventName', (data) => {
11
+ const listener = NativeUpdate.addListener('eventName', (data) => {
12
12
  console.log('Event data:', data);
13
13
  });
14
14
 
@@ -16,7 +16,7 @@ const listener = CapacitorNativeUpdate.addListener('eventName', (data) => {
16
16
  listener.remove();
17
17
 
18
18
  // Remove all listeners for an event
19
- CapacitorNativeUpdate.removeAllListeners('eventName');
19
+ NativeUpdate.removeAllListeners('eventName');
20
20
  ```
21
21
 
22
22
  ## Live Update Events
@@ -26,7 +26,7 @@ CapacitorNativeUpdate.removeAllListeners('eventName');
26
26
  Fired when the update state changes during sync or download.
27
27
 
28
28
  ```typescript
29
- CapacitorNativeUpdate.addListener('updateStateChanged', (state) => {
29
+ NativeUpdate.addListener('updateStateChanged', (state) => {
30
30
  console.log('Update state:', state);
31
31
  });
32
32
  ```
@@ -47,7 +47,7 @@ CapacitorNativeUpdate.addListener('updateStateChanged', (state) => {
47
47
  Fired periodically during bundle download.
48
48
 
49
49
  ```typescript
50
- CapacitorNativeUpdate.addListener('downloadProgress', (progress) => {
50
+ NativeUpdate.addListener('downloadProgress', (progress) => {
51
51
  console.log(`Download: ${progress.percent}%`);
52
52
  });
53
53
  ```
@@ -69,7 +69,7 @@ CapacitorNativeUpdate.addListener('downloadProgress', (progress) => {
69
69
  Fired when an update has been successfully installed.
70
70
 
71
71
  ```typescript
72
- CapacitorNativeUpdate.addListener('updateInstalled', (update) => {
72
+ NativeUpdate.addListener('updateInstalled', (update) => {
73
73
  console.log('Update installed:', update.version);
74
74
  });
75
75
  ```
@@ -90,7 +90,7 @@ CapacitorNativeUpdate.addListener('updateInstalled', (update) => {
90
90
  Fired when an update fails to download or install.
91
91
 
92
92
  ```typescript
93
- CapacitorNativeUpdate.addListener('updateFailed', (error) => {
93
+ NativeUpdate.addListener('updateFailed', (error) => {
94
94
  console.error('Update failed:', error);
95
95
  });
96
96
  ```
@@ -115,7 +115,7 @@ CapacitorNativeUpdate.addListener('updateFailed', (error) => {
115
115
  Fired when the app rolls back to a previous version.
116
116
 
117
117
  ```typescript
118
- CapacitorNativeUpdate.addListener('rollbackOccurred', (rollback) => {
118
+ NativeUpdate.addListener('rollbackOccurred', (rollback) => {
119
119
  console.log('Rolled back from:', rollback.failedVersion);
120
120
  });
121
121
  ```
@@ -138,7 +138,7 @@ CapacitorNativeUpdate.addListener('rollbackOccurred', (rollback) => {
138
138
  Fired when native app update state changes. Android only.
139
139
 
140
140
  ```typescript
141
- CapacitorNativeUpdate.addListener('appUpdateStateChanged', (state) => {
141
+ NativeUpdate.addListener('appUpdateStateChanged', (state) => {
142
142
  console.log('App update state:', state);
143
143
  });
144
144
  ```
@@ -168,7 +168,7 @@ CapacitorNativeUpdate.addListener('appUpdateStateChanged', (state) => {
168
168
  Fired during flexible app update download. Android only.
169
169
 
170
170
  ```typescript
171
- CapacitorNativeUpdate.addListener('appUpdateProgress', (progress) => {
171
+ NativeUpdate.addListener('appUpdateProgress', (progress) => {
172
172
  console.log('App update progress:', progress.percentComplete);
173
173
  });
174
174
  ```
@@ -189,7 +189,7 @@ CapacitorNativeUpdate.addListener('appUpdateProgress', (progress) => {
189
189
  Fired when an app update becomes available.
190
190
 
191
191
  ```typescript
192
- CapacitorNativeUpdate.addListener('appUpdateAvailable', (update) => {
192
+ NativeUpdate.addListener('appUpdateAvailable', (update) => {
193
193
  console.log('App update available:', update.version);
194
194
  });
195
195
  ```
@@ -213,7 +213,7 @@ CapacitorNativeUpdate.addListener('appUpdateAvailable', (update) => {
213
213
  Fired when a review prompt is shown to the user.
214
214
 
215
215
  ```typescript
216
- CapacitorNativeUpdate.addListener('reviewPromptDisplayed', (event) => {
216
+ NativeUpdate.addListener('reviewPromptDisplayed', (event) => {
217
217
  analytics.track('review_prompt_shown');
218
218
  });
219
219
  ```
@@ -233,7 +233,7 @@ CapacitorNativeUpdate.addListener('reviewPromptDisplayed', (event) => {
233
233
  Fired when the review prompt is dismissed.
234
234
 
235
235
  ```typescript
236
- CapacitorNativeUpdate.addListener('reviewPromptDismissed', (event) => {
236
+ NativeUpdate.addListener('reviewPromptDismissed', (event) => {
237
237
  console.log('Review prompt dismissed');
238
238
  });
239
239
  ```
@@ -254,7 +254,7 @@ CapacitorNativeUpdate.addListener('reviewPromptDismissed', (event) => {
254
254
  Fired when a background update check begins.
255
255
 
256
256
  ```typescript
257
- CapacitorNativeUpdate.addListener('backgroundCheckStarted', (event) => {
257
+ NativeUpdate.addListener('backgroundCheckStarted', (event) => {
258
258
  console.log('Background check started');
259
259
  });
260
260
  ```
@@ -273,7 +273,7 @@ CapacitorNativeUpdate.addListener('backgroundCheckStarted', (event) => {
273
273
  Fired when a background update check completes.
274
274
 
275
275
  ```typescript
276
- CapacitorNativeUpdate.addListener('backgroundCheckCompleted', (result) => {
276
+ NativeUpdate.addListener('backgroundCheckCompleted', (result) => {
277
277
  console.log('Background check result:', result);
278
278
  });
279
279
  ```
@@ -295,7 +295,7 @@ CapacitorNativeUpdate.addListener('backgroundCheckCompleted', (result) => {
295
295
  Fired when a background download completes.
296
296
 
297
297
  ```typescript
298
- CapacitorNativeUpdate.addListener('backgroundDownloadCompleted', (result) => {
298
+ NativeUpdate.addListener('backgroundDownloadCompleted', (result) => {
299
299
  console.log('Background download completed');
300
300
  });
301
301
  ```
@@ -319,7 +319,7 @@ CapacitorNativeUpdate.addListener('backgroundDownloadCompleted', (result) => {
319
319
  Generic error event for any plugin errors.
320
320
 
321
321
  ```typescript
322
- CapacitorNativeUpdate.addListener('error', (error) => {
322
+ NativeUpdate.addListener('error', (error) => {
323
323
  console.error('Plugin error:', error);
324
324
  errorReporting.log(error);
325
325
  });
@@ -345,7 +345,7 @@ CapacitorNativeUpdate.addListener('error', (error) => {
345
345
  Fired for analytics tracking.
346
346
 
347
347
  ```typescript
348
- CapacitorNativeUpdate.addListener('analyticsEvent', (event) => {
348
+ NativeUpdate.addListener('analyticsEvent', (event) => {
349
349
  // Forward to your analytics provider
350
350
  analytics.track(event.name, event.properties);
351
351
  });
@@ -372,9 +372,9 @@ class UpdateEventManager {
372
372
  init() {
373
373
  // Register all listeners
374
374
  this.listeners.push(
375
- CapacitorNativeUpdate.addListener('updateStateChanged', this.handleStateChange),
376
- CapacitorNativeUpdate.addListener('downloadProgress', this.handleProgress),
377
- CapacitorNativeUpdate.addListener('error', this.handleError)
375
+ NativeUpdate.addListener('updateStateChanged', this.handleStateChange),
376
+ NativeUpdate.addListener('downloadProgress', this.handleProgress),
377
+ NativeUpdate.addListener('error', this.handleError)
378
378
  );
379
379
  }
380
380
 
@@ -414,10 +414,10 @@ function useUpdateState() {
414
414
 
415
415
  useEffect(() => {
416
416
  const listeners = [
417
- CapacitorNativeUpdate.addListener('updateStateChanged', (event) => {
417
+ NativeUpdate.addListener('updateStateChanged', (event) => {
418
418
  setState(event.status);
419
419
  }),
420
- CapacitorNativeUpdate.addListener('downloadProgress', (event) => {
420
+ NativeUpdate.addListener('downloadProgress', (event) => {
421
421
  setProgress(event.percent);
422
422
  })
423
423
  ];
@@ -435,7 +435,7 @@ function useUpdateState() {
435
435
 
436
436
  ```typescript
437
437
  // Set up analytics forwarding
438
- CapacitorNativeUpdate.addListener('analyticsEvent', (event) => {
438
+ NativeUpdate.addListener('analyticsEvent', (event) => {
439
439
  switch (analyticsProvider) {
440
440
  case 'firebase':
441
441
  firebase.analytics().logEvent(event.name, event.properties);
@@ -9,7 +9,7 @@ Complete API documentation for Live/OTA update functionality.
9
9
  Configure the Live Update plugin with server settings and behavior options.
10
10
 
11
11
  ```typescript
12
- await CapacitorNativeUpdate.configure({
12
+ await NativeUpdate.configure({
13
13
  serverUrl: string; // Update server URL (required)
14
14
  channel?: string; // Update channel (default: "production")
15
15
  autoCheck?: boolean; // Auto-check for updates (default: true)
@@ -30,7 +30,7 @@ await CapacitorNativeUpdate.configure({
30
30
  Check if a new update is available.
31
31
 
32
32
  ```typescript
33
- const result = await CapacitorNativeUpdate.checkForUpdate();
33
+ const result = await NativeUpdate.checkForUpdate();
34
34
  // Returns:
35
35
  {
36
36
  available: boolean; // Update available?
@@ -49,7 +49,7 @@ const result = await CapacitorNativeUpdate.checkForUpdate();
49
49
  Download an available update with progress tracking.
50
50
 
51
51
  ```typescript
52
- const result = await CapacitorNativeUpdate.downloadUpdate({
52
+ const result = await NativeUpdate.downloadUpdate({
53
53
  onProgress?: (progress: {
54
54
  percent: number; // 0-100
55
55
  bytesDownloaded: number;
@@ -71,7 +71,7 @@ const result = await CapacitorNativeUpdate.downloadUpdate({
71
71
  Apply a downloaded update (restarts the app).
72
72
 
73
73
  ```typescript
74
- await CapacitorNativeUpdate.applyUpdate();
74
+ await NativeUpdate.applyUpdate();
75
75
  ```
76
76
 
77
77
  ### sync(options?)
@@ -79,7 +79,7 @@ await CapacitorNativeUpdate.applyUpdate();
79
79
  Sync with server and apply updates based on strategy.
80
80
 
81
81
  ```typescript
82
- const result = await CapacitorNativeUpdate.sync({
82
+ const result = await NativeUpdate.sync({
83
83
  installMode?: 'IMMEDIATE' | 'ON_NEXT_RESTART' | 'ON_NEXT_RESUME';
84
84
  minimumBackgroundDuration?: number; // Minimum background time (ms)
85
85
  });
@@ -96,7 +96,7 @@ const result = await CapacitorNativeUpdate.sync({
96
96
  Get information about the currently active bundle.
97
97
 
98
98
  ```typescript
99
- const bundle = await CapacitorNativeUpdate.getCurrentBundle();
99
+ const bundle = await NativeUpdate.getCurrentBundle();
100
100
  // Returns:
101
101
  {
102
102
  bundleId: string;
@@ -115,7 +115,7 @@ const bundle = await CapacitorNativeUpdate.getCurrentBundle();
115
115
  List all downloaded bundles.
116
116
 
117
117
  ```typescript
118
- const result = await CapacitorNativeUpdate.getBundles();
118
+ const result = await NativeUpdate.getBundles();
119
119
  // Returns:
120
120
  {
121
121
  bundles: Array<{
@@ -133,7 +133,7 @@ const result = await CapacitorNativeUpdate.getBundles();
133
133
  Set a specific bundle as active.
134
134
 
135
135
  ```typescript
136
- await CapacitorNativeUpdate.setBundle(bundleId: string);
136
+ await NativeUpdate.setBundle(bundleId: string);
137
137
  ```
138
138
 
139
139
  ### deleteBundle(bundleId)
@@ -142,10 +142,10 @@ Delete a specific bundle or clean up old bundles.
142
142
 
143
143
  ```typescript
144
144
  // Delete specific bundle
145
- await CapacitorNativeUpdate.deleteBundle(bundleId: string);
145
+ await NativeUpdate.deleteBundle(bundleId: string);
146
146
 
147
147
  // Or cleanup old bundles
148
- await CapacitorNativeUpdate.deleteBundle({
148
+ await NativeUpdate.deleteBundle({
149
149
  keepVersions: number // Keep N most recent versions
150
150
  });
151
151
  ```
@@ -155,7 +155,7 @@ await CapacitorNativeUpdate.deleteBundle({
155
155
  Reset to the original app bundle.
156
156
 
157
157
  ```typescript
158
- await CapacitorNativeUpdate.reset();
158
+ await NativeUpdate.reset();
159
159
  ```
160
160
 
161
161
  ### notifyAppReady()
@@ -163,7 +163,7 @@ await CapacitorNativeUpdate.reset();
163
163
  Notify that the app has successfully started with the new bundle.
164
164
 
165
165
  ```typescript
166
- await CapacitorNativeUpdate.notifyAppReady();
166
+ await NativeUpdate.notifyAppReady();
167
167
  ```
168
168
 
169
169
  ### pauseAutoUpdates()
@@ -171,7 +171,7 @@ await CapacitorNativeUpdate.notifyAppReady();
171
171
  Temporarily pause automatic update checks.
172
172
 
173
173
  ```typescript
174
- await CapacitorNativeUpdate.pauseAutoUpdates();
174
+ await NativeUpdate.pauseAutoUpdates();
175
175
  ```
176
176
 
177
177
  ### resumeAutoUpdates()
@@ -179,7 +179,7 @@ await CapacitorNativeUpdate.pauseAutoUpdates();
179
179
  Resume automatic update checks.
180
180
 
181
181
  ```typescript
182
- await CapacitorNativeUpdate.resumeAutoUpdates();
182
+ await NativeUpdate.resumeAutoUpdates();
183
183
  ```
184
184
 
185
185
  ### setChannel(channel)
@@ -187,7 +187,7 @@ await CapacitorNativeUpdate.resumeAutoUpdates();
187
187
  Change the update channel.
188
188
 
189
189
  ```typescript
190
- await CapacitorNativeUpdate.setChannel(channel: string);
190
+ await NativeUpdate.setChannel(channel: string);
191
191
  ```
192
192
 
193
193
  ### setUpdateUrl(url)
@@ -195,7 +195,7 @@ await CapacitorNativeUpdate.setChannel(channel: string);
195
195
  Change the update server URL.
196
196
 
197
197
  ```typescript
198
- await CapacitorNativeUpdate.setUpdateUrl(url: string);
198
+ await NativeUpdate.setUpdateUrl(url: string);
199
199
  ```
200
200
 
201
201
  ### validateUpdate(options)
@@ -203,7 +203,7 @@ await CapacitorNativeUpdate.setUpdateUrl(url: string);
203
203
  Validate a bundle's integrity.
204
204
 
205
205
  ```typescript
206
- const result = await CapacitorNativeUpdate.validateUpdate({
206
+ const result = await NativeUpdate.validateUpdate({
207
207
  bundlePath: string;
208
208
  checksum: string;
209
209
  signature?: string;
@@ -225,7 +225,7 @@ const result = await CapacitorNativeUpdate.validateUpdate({
225
225
  Fired when update state changes.
226
226
 
227
227
  ```typescript
228
- CapacitorNativeUpdate.addListener('updateStateChanged', (state) => {
228
+ NativeUpdate.addListener('updateStateChanged', (state) => {
229
229
  console.log('State:', state.status);
230
230
  // state.status: 'CHECKING' | 'DOWNLOADING' | 'READY' | 'FAILED'
231
231
  });
@@ -236,7 +236,7 @@ CapacitorNativeUpdate.addListener('updateStateChanged', (state) => {
236
236
  Fired during bundle download.
237
237
 
238
238
  ```typescript
239
- CapacitorNativeUpdate.addListener('downloadProgress', (progress) => {
239
+ NativeUpdate.addListener('downloadProgress', (progress) => {
240
240
  console.log(`Progress: ${progress.percent}%`);
241
241
  });
242
242
  ```
@@ -246,7 +246,7 @@ CapacitorNativeUpdate.addListener('downloadProgress', (progress) => {
246
246
  Fired when an error occurs.
247
247
 
248
248
  ```typescript
249
- CapacitorNativeUpdate.addListener('error', (error) => {
249
+ NativeUpdate.addListener('error', (error) => {
250
250
  console.error('Update error:', error.code, error.message);
251
251
  });
252
252
  ```
@@ -24,12 +24,12 @@ The Background Update feature allows your app to check for updates automatically
24
24
 
25
25
  ```typescript
26
26
  import {
27
- CapacitorNativeUpdate,
27
+ NativeUpdate,
28
28
  BackgroundUpdateType,
29
- } from 'capacitor-native-update';
29
+ } from 'native-update';
30
30
 
31
31
  // Configure the plugin with background updates
32
- await CapacitorNativeUpdate.configure({
32
+ await NativeUpdate.configure({
33
33
  backgroundUpdate: {
34
34
  enabled: true,
35
35
  checkInterval: 24 * 60 * 60 * 1000, // 24 hours
@@ -57,7 +57,7 @@ await CapacitorNativeUpdate.configure({
57
57
 
58
58
  ```typescript
59
59
  // Advanced background update configuration
60
- await CapacitorNativeUpdate.configure({
60
+ await NativeUpdate.configure({
61
61
  backgroundUpdate: {
62
62
  enabled: true,
63
63
  checkInterval: 12 * 60 * 60 * 1000, // 12 hours
@@ -97,7 +97,7 @@ await CapacitorNativeUpdate.configure({
97
97
  ### Enable Background Updates
98
98
 
99
99
  ```typescript
100
- await CapacitorNativeUpdate.enableBackgroundUpdates({
100
+ await NativeUpdate.enableBackgroundUpdates({
101
101
  enabled: true,
102
102
  checkInterval: 24 * 60 * 60 * 1000,
103
103
  updateTypes: [BackgroundUpdateType.BOTH],
@@ -107,13 +107,13 @@ await CapacitorNativeUpdate.enableBackgroundUpdates({
107
107
  ### Disable Background Updates
108
108
 
109
109
  ```typescript
110
- await CapacitorNativeUpdate.disableBackgroundUpdates();
110
+ await NativeUpdate.disableBackgroundUpdates();
111
111
  ```
112
112
 
113
113
  ### Get Background Update Status
114
114
 
115
115
  ```typescript
116
- const status = await CapacitorNativeUpdate.getBackgroundUpdateStatus();
116
+ const status = await NativeUpdate.getBackgroundUpdateStatus();
117
117
  console.log('Background updates enabled:', status.enabled);
118
118
  console.log('Last check:', new Date(status.lastCheckTime));
119
119
  console.log('Next check:', new Date(status.nextCheckTime));
@@ -122,7 +122,7 @@ console.log('Next check:', new Date(status.nextCheckTime));
122
122
  ### Trigger Manual Check
123
123
 
124
124
  ```typescript
125
- const result = await CapacitorNativeUpdate.triggerBackgroundCheck();
125
+ const result = await NativeUpdate.triggerBackgroundCheck();
126
126
  if (result.updatesFound) {
127
127
  console.log('Updates found!', result.appUpdate, result.liveUpdate);
128
128
  }
@@ -132,7 +132,7 @@ if (result.updatesFound) {
132
132
 
133
133
  ```typescript
134
134
  // Set notification preferences
135
- await CapacitorNativeUpdate.setNotificationPreferences({
135
+ await NativeUpdate.setNotificationPreferences({
136
136
  title: 'Custom Update Title',
137
137
  description: 'Custom update message',
138
138
  soundEnabled: true,
@@ -146,13 +146,13 @@ await CapacitorNativeUpdate.setNotificationPreferences({
146
146
  });
147
147
 
148
148
  // Request notification permissions
149
- const granted = await CapacitorNativeUpdate.requestNotificationPermissions();
149
+ const granted = await NativeUpdate.requestNotificationPermissions();
150
150
  if (granted) {
151
151
  console.log('Notification permissions granted');
152
152
  }
153
153
 
154
154
  // Check permission status
155
- const permissions = await CapacitorNativeUpdate.getNotificationPermissions();
155
+ const permissions = await NativeUpdate.getNotificationPermissions();
156
156
  console.log('Permissions granted:', permissions.granted);
157
157
  ```
158
158
 
@@ -161,7 +161,7 @@ console.log('Permissions granted:', permissions.granted);
161
161
  ### Background Update Progress
162
162
 
163
163
  ```typescript
164
- CapacitorNativeUpdate.addListener('backgroundUpdateProgress', (event) => {
164
+ NativeUpdate.addListener('backgroundUpdateProgress', (event) => {
165
165
  console.log('Background update progress:', event.status, event.percent);
166
166
  });
167
167
  ```
@@ -169,7 +169,7 @@ CapacitorNativeUpdate.addListener('backgroundUpdateProgress', (event) => {
169
169
  ### Background Update Notifications
170
170
 
171
171
  ```typescript
172
- CapacitorNativeUpdate.addListener('backgroundUpdateNotification', (event) => {
172
+ NativeUpdate.addListener('backgroundUpdateNotification', (event) => {
173
173
  console.log('Notification action:', event.action);
174
174
 
175
175
  switch (event.action) {
@@ -243,13 +243,13 @@ Add to your `AndroidManifest.xml`:
243
243
 
244
244
  ```typescript
245
245
  try {
246
- await CapacitorNativeUpdate.enableBackgroundUpdates(config);
246
+ await NativeUpdate.enableBackgroundUpdates(config);
247
247
  } catch (error) {
248
248
  console.error('Failed to enable background updates:', error);
249
249
  }
250
250
 
251
251
  // Listen for background update errors
252
- CapacitorNativeUpdate.addListener('backgroundUpdateProgress', (event) => {
252
+ NativeUpdate.addListener('backgroundUpdateProgress', (event) => {
253
253
  if (event.status === 'failed' && event.error) {
254
254
  console.error('Background update failed:', event.error);
255
255
  }
@@ -316,14 +316,14 @@ class BackgroundUpdateManager {
316
316
 
317
317
  // Request notification permissions first
318
318
  const granted =
319
- await CapacitorNativeUpdate.requestNotificationPermissions();
319
+ await NativeUpdate.requestNotificationPermissions();
320
320
  if (!granted) {
321
321
  console.warn('Notification permissions not granted');
322
322
  return;
323
323
  }
324
324
 
325
325
  // Configure background updates
326
- await CapacitorNativeUpdate.configure({
326
+ await NativeUpdate.configure({
327
327
  backgroundUpdate: {
328
328
  enabled: true,
329
329
  checkInterval: 24 * 60 * 60 * 1000, // 24 hours
@@ -344,7 +344,7 @@ class BackgroundUpdateManager {
344
344
  });
345
345
 
346
346
  // Set up event listeners
347
- CapacitorNativeUpdate.addListener(
347
+ NativeUpdate.addListener(
348
348
  'backgroundUpdateNotification',
349
349
  (event) => {
350
350
  this.handleNotificationAction(event.action);