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
#### [Sign up With App Center](https://appcenter.ms/signup?utm_source=CodePush&utm_medium=Azure) to use CodePush
4
2
5
3
# React Native Module for CodePush
6
-
> [!WARNING]
7
-
> React Native CodePush won't support new Architecture. In order to use this plugin on React Native versions starting from 0.76 you will need to [opt out](https://reactnative.dev/blog/2024/10/23/the-new-architecture-is-here#opt-out) from new architecture.
8
-
>
9
-
*Note: This README is only relevant to the latest version of our plugin. If you are using an older version, please switch to the relevant tag on [our GitHub repo](https://github.com/microsoft/react-native-code-push) to view the docs for that particular version.*
This plugin provides client-side integration for the [CodePush service](https://microsoft.github.io/code-push/), allowing you to easily add a dynamic update experience to your React Native app(s).
14
6
@@ -53,36 +45,16 @@ In order to ensure that your end users always have a functioning version of your
53
45
54
46
- iOS (7+)
55
47
- Android (4.1+) on TLS 1.2 compatible devices
56
-
- Windows (UWP)
48
+
- Windows (UWP) - Not Tested. We recommend to use [microsoft/code-push-react-native](https://github.com/microsoft/react-native-code-push)
57
49
58
50
We try our best to maintain backwards compatibility of our plugin with previous versions of React Native, but due to the nature of the platform, and the existence of breaking changes between releases, it is possible that you need to use a specific version of the CodePush plugin in order to support the exact version of React Native you are using. The following table outlines which CodePush plugin versions officially support the respective React Native versions:
| v0.71 | v8.0+ *(RN moved to react-native-gradle-plugin)*|
82
-
83
-
*NOTE: `react-native-code-push` versions lower than **[v5.7.0](https://github.com/microsoft/react-native-code-push/releases/tag/v5.7.0)** will stop working in the near future. You can find more information in our [documentation](https://github.com/microsoft/code-push/blob/master/migration-notice.md).*
84
-
85
-
We work hard to respond to new RN releases, but they do occasionally break us. We will update this chart with each RN release, so that users can check to see what our "official" support is.
| v0.76 | v10.0+ *(Available for Old/New Architecture)*|
56
+
57
+
86
58
87
59
### Supported Components
88
60
@@ -117,7 +89,7 @@ As new core components are released, which support referencing assets, we'll upd
117
89
Once you've followed the general-purpose ["getting started"](https://docs.microsoft.com/en-us/appcenter/distribution/codepush/index) instructions for setting up your CodePush account, you can start CodePush-ifying your React Native app by running the following command from within your app's root directory:
118
90
119
91
```shell
120
-
npm install --save react-native-code-push
92
+
yarn add @code-push-next/react-native-code-push
121
93
```
122
94
123
95
As with all other React Native plugins, the integration experience is different for iOS and Android, so perform the following setup steps depending on which platform(s) you are targeting. Note, if you are targeting both platforms it is recommended to create separate CodePush applications for each platform.
Copy file name to clipboardExpand all lines: docs/api-android.md
+3-5Lines changed: 3 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,4 @@
1
-
### Java API Reference (Android)
2
-
3
-
### API for React Native 0.60 version and above
1
+
### Resource Configuration
4
2
5
3
Since `autolinking` uses `react-native.config.js` to link plugins, constructors are specified in that file. But you can override custom variables to manage the CodePush plugin by placing these values in string resources.
6
4
@@ -16,10 +14,10 @@ Since `autolinking` uses `react-native.config.js` to link plugins, constructors
The Java API is made available by importing the `com.microsoft.codepush.react.CodePush` class into your `MainActivity.java` file, and consists of a single public class named `CodePush`.
22
18
19
+
### Java API Reference (Android)
20
+
23
21
#### CodePush
24
22
25
23
Constructs the CodePush client runtime and represents the `ReactPackage` instance that you add to you app's list of packages.
Copy file name to clipboardExpand all lines: docs/multi-deployment-testing-android.md
+1-94Lines changed: 1 addition & 94 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ The [Android Gradle plugin](https://google.github.io/android-gradle-dsl/current/
10
10
11
11
To set this up, perform the following steps:
12
12
13
-
**For React Native >= v0.60**
13
+
**For React Native >= v0.76**
14
14
15
15
1. Open the project's app level `build.gradle` file (for example `android/app/build.gradle` in standard React Native projects)
16
16
@@ -51,98 +51,5 @@ To set this up, perform the following steps:
51
51
52
52
*NOTE: The naming convention for `releaseStaging` is significant due to [this line](https://github.com/facebook/react-native/blob/e083f9a139b3f8c5552528f8f8018529ef3193b9/react.gradle#L79).*
53
53
54
-
**For React Native v0.29 - v0.59**
55
-
56
-
1. Open up your `MainApplication.java` file and make the following changes:
57
-
58
-
```java
59
-
@Override
60
-
protected List<ReactPackage> getPackages() {
61
-
return Arrays.<ReactPackage>asList(
62
-
...
63
-
new CodePush(BuildConfig.CODEPUSH_KEY, MainApplication.this, BuildConfig.DEBUG), // Add/change this line.
64
-
...
65
-
);
66
-
}
67
-
```
68
-
69
-
2. Open your app's `build.gradle` file (for example `android/app/build.gradle` in standard React Native projects)
70
-
71
-
3. Find the `android { buildTypes {} }` section and define `buildConfigField` entries for both your `debug` and `release` build types, which reference your `Staging` and `Production` deployment keys respectively. If you prefer, you can define the key literals in your `gradle.properties` file, and then reference them here. Either way will work, and it's just a matter of personal preference.
72
-
73
-
```groovy
74
-
android {
75
-
...
76
-
buildTypes {
77
-
debug {
78
-
...
79
-
// Note: CodePush updates should not be tested in Debug mode as they are overriden by the RN packager. However, because CodePush checks for updates in all modes, we must supply a key.
*NOTE: The naming convention for `releaseStaging` is significant due to [this line](https://github.com/facebook/react-native/blob/e083f9a139b3f8c5552528f8f8018529ef3193b9/react.gradle#L79).*
104
-
105
-
4. Pass the deployment key to the `CodePush` constructor via the build config you defined, as opposed to a string literal.
106
-
107
-
**For React Native v0.19 - v0.28**
108
-
109
-
Open up your `MainActivity.java` file and make the following changes:
110
-
111
-
```java
112
-
@Override
113
-
protected List<ReactPackage> getPackages() {
114
-
return Arrays.<ReactPackage>asList(
115
-
...
116
-
new CodePush(BuildConfig.CODEPUSH_KEY, this, BuildConfig.DEBUG), // Add/change this line.
117
-
...
118
-
);
119
-
}
120
-
```
121
-
122
-
*Note: If you gave your build setting a different name in your Gradle file, simply make sure to reflect that in your Java code.*
123
-
124
-
And that's it! Now when you run or build your app, your debug builds will automatically be configured to sync with your `Staging` deployment, and your release builds will be configured to sync with your `Production` deployment.
125
-
126
-
*NOTE: By default, the `react-native run-android` command builds and deploys the debug version of your app, so if you want to test out a release/production build, simply run `react-native run-android --variant release. Refer to the [React Native docs](http://facebook.github.io/react-native/docs/signed-apk-android.html#conten) for details about how to configure and create release builds for your Android apps.*
127
-
128
-
If you want to be able to install both debug and release builds simultaneously on the same device (highly recommended!), then you need to ensure that your debug build has a unique identity and icon from your release build. Otherwise, neither the OS nor you will be able to differentiate between the two. You can achieve this by performing the following steps:
129
-
130
-
1. In your `build.gradle` file, specify the [`applicationIdSuffix`](http://google.github.io/android-gradle-dsl/current/com.android.build.gradle.internal.dsl.BuildType.html#com.android.build.gradle.internal.dsl.BuildType:applicationIdSuffix) field for your debug build type, which gives your debug build a unique identity for the OS (like `com.foo` vs. `com.foo.debug`).
131
-
132
-
```groovy
133
-
buildTypes {
134
-
debug {
135
-
applicationIdSuffix ".debug"
136
-
}
137
-
}
138
-
```
139
-
140
-
2. Create the `app/src/debug/res` directory structure in your app, which allows overriding resources (like strings, icons, layouts) for your debug builds
141
-
142
-
3. Create a `values` directory underneath the debug res directory created in #2, and copy the existing `strings.xml` file from the `app/src/main/res/values` directory
143
-
144
-
4. Open up the new debug `strings.xml` file and change the `<string name="app_name">` element's value to something else (like `foo-debug`). This ensures that your debug build now has a distinct display name, so that you can differentiate it from your release build.
145
-
146
-
5. Optionally, create "mirrored" directories in the `app/src/debug/res` directory for all of your app's icons that you want to change for your debug build. This part isn't technically critical, but it can make it easier to quickly spot your debug builds on a device if its icon is noticeable different.
147
54
148
55
And that's it! View [here](http://tools.android.com/tech-docs/new-build-system/resource-merging) for more details on how resource merging works in Android.
0 commit comments