You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 20, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+35Lines changed: 35 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -378,6 +378,8 @@ When you require `react-native-code-push`, the module object provides the follow
378
378
379
379
* [checkForUpdate](#codepushcheckforupdate): Asks the CodePush service whether the configured app deployment has an update available.
380
380
381
+
* [getCurrentPackage](#codepushgetcurrentpackage): Retrieves the metadata about the currently installed update (e.g. description, installation time, size). *NOTE: As of`v1.10.3-beta`of the CodePush module, this method is deprecated in favor of [`getUpdateMetadata`](#codepushgetupdatemetadata)*.
382
+
381
383
* [getUpdateMetadata](#codepushgetupdatemetadata): Retrieves the metadata for an installed update (e.g. description, mandatory).
382
384
383
385
* [notifyApplicationReady](#codepushnotifyapplicationready): Notifies the CodePush runtime that an installed update is considered successful. If you are manually checking for and installing updates (i.e. not using the [sync](#codepushsync) method to handle it all for you), then this method **MUST** be called; otherwise CodePush will treat the update as failed and rollback to the previous version when the app next restarts.
@@ -417,6 +419,39 @@ codePush.checkForUpdate()
417
419
});
418
420
```
419
421
422
+
#### codePush.getCurrentPackage
423
+
424
+
*NOTE: This method is considered deprecated as of `v1.10.3-beta` of the CodePush module. If you're running this version (or newer), we would recommend using the [`codePush.getUpdateMetadata`](#codepushgetupdatemetadata) instead, since it has more predictable behavior.*
Retrieves the metadata about the currently installed "package" (e.g. description, installation time). This can be useful for scenarios such as displaying a "what's new?" dialog after an update has been applied or checking whether there is a pending update that is waiting to be applied via a resume or restart.
431
+
432
+
This method returns a `Promise` which resolves to one of two possible values:
433
+
434
+
1. `null` if the app is currently running the JS bundle from the binary and not a CodePush update. This occurs in the following scenarios:
435
+
436
+
1. The end-user installed the app binary and has yet to install a CodePush update
437
+
1. The end-user installed an update of the binary (e.g. from the store), which cleared away the old CodePush updates, and gave precedence back to the JS binary in the binary.
438
+
439
+
2. A [`LocalPackage`](#localpackage) instance which represents the metadata for the currently running CodePush update.
440
+
441
+
Example Usage:
442
+
443
+
```javascript
444
+
codePush.getCurrentPackage()
445
+
.then((update) => {
446
+
// If the current app "session" represents the first time
447
+
// this update has run, and it had a description provided
448
+
// with it upon release, let's show it to the end user
0 commit comments