Skip to content

Commit 201735e

Browse files
Anna Kocheshkovaalexandergoncharov-zz
Anna Kocheshkova
authored andcommitted
Get update folder method (#1323)
* Exposed current update path. * Check for null * API reference update
1 parent da56a35 commit 201735e

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

android/app/src/main/java/com/microsoft/codepush/react/CodePush.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import org.json.JSONObject;
1818

1919
import java.io.File;
20-
import java.io.NotActiveException;
2120
import java.util.ArrayList;
2221
import java.util.List;
2322

@@ -159,6 +158,14 @@ long getBinaryResourcesModifiedTime() {
159158
}
160159
}
161160

161+
public String getPackageFolder() {
162+
JSONObject codePushLocalPackage = mUpdateManager.getCurrentPackage();
163+
if (codePushLocalPackage == null) {
164+
return null;
165+
}
166+
return mUpdateManager.getPackageFolderPath(codePushLocalPackage.optString("packageHash"));
167+
}
168+
162169
@Deprecated
163170
public static String getBundleUrl() {
164171
return getJSBundleFile();

docs/api-android.md

+2
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,6 @@ As an alternative to constructors *you can also use `CodePushBuilder`* to setup
5757

5858
- __getBundleUrl(String bundleName)__ - Returns the path to the most recent version of your app's JS bundle file, using the specified resource name (e.g. `index.android.bundle`). This method has the same resolution behavior as the Objective-C equivalent described above.
5959

60+
- __getPackageFolder()__ - Returns the path to the current update folder.
61+
6062
- __overrideAppVersion(String appVersionOverride)__ - Sets the version of the application's binary interface, which would otherwise default to the Play Store version specified as the `versionName` in the `build.gradle`. This should be called a single time, before the CodePush instance is constructed.

0 commit comments

Comments
 (0)