Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit bebb205

Browse files
committed
Adding initial Windows doc
1 parent 92da7c6 commit bebb205

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ This plugin provides client-side integration for the [CodePush service](http://c
1717
* [RNPM](#plugin-installation-android---rnpm)
1818
* ["Manual"](#plugin-installation-android---manual)
1919
* [Plugin Configuration](#plugin-configuration-android)
20+
* [Windows Setup](#windows-setup)
21+
* [Plugin Installation](#plugin-installation-windows)
22+
* [Plugin Configuration](#plugin-configuration-windows)
2023
* [Plugin Usage](#plugin-usage)
2124
* [Releasing Updates](#releasing-updates)
2225
* [API Reference](#api-reference)
@@ -40,6 +43,7 @@ In order to ensure that your end users always have a functioning version of your
4043

4144
- iOS
4245
- Android
46+
- Windows
4347

4448
We try our best to maintain backwards compatability 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:
4549

@@ -286,6 +290,61 @@ public class MainActivity extends ReactActivity {
286290
}
287291
```
288292

293+
## Windows Setup
294+
295+
Once you've acquired the CodePush plugin, you need to integrate it into the Visual Studio project of your React Native app and configure it correctly. To do this, take the following steps:
296+
297+
### Plugin Installation (Windows)
298+
299+
1. Open the Visual Studio solution located at `windows\<AppName>\<AppName>.sln` within your app
300+
301+
2. Right-click the solution node in the `Solution Explorer` window and select the `Add -> Existing Project...` menu item
302+
303+
3. Browse to the `node_modules\react-native-code-push\windows` directory, select the `CodePush.sln` file and click `OK`
304+
305+
4. Back in the `Solution Explorer`, right-click the project node that is named after your app, and select the `Add -> Reference...` menu item
306+
307+
5. Select the `Projects` tab on the left hand side, check the `CodePush` item and then click `OK`
308+
309+
### Plugin Configuration (Windows)
310+
311+
After installing the plugin, you need to configure your app to consult CodePush for the location of your JS bundle, since it will "take control" of managing the current and all future versions. To do this, update the `AppReactage.cs` file to use CodePush via the following changes:
312+
313+
```c#
314+
...
315+
// 1. Import the CodePush namespace
316+
using CodePush;
317+
318+
public class MainActivity extends ReactActivity {
319+
// 2. Update the JavaScriptBundleFile property to return the
320+
// bundle URL from CodePush instead of staticaly from the binary
321+
public override string JavaScriptBundleFile
322+
{
323+
get
324+
{
325+
return CodePush.getBundleUrl();
326+
}
327+
}
328+
329+
// 3. Instantiate an instance of the CodePush runtime and add it to the list of
330+
// existing packages, specifying the right deployment key. If you don't already
331+
// have it, you can run "code-push deployment ls <appName> -k" to retrieve your key.
332+
public override List<IReactPackage> Packages
333+
{
334+
get
335+
{
336+
return new List<IReactPackage>
337+
{
338+
new MainReactPackage(),
339+
...
340+
new CodePush("DEPLOYMENT_KEY", this)
341+
};
342+
}
343+
}
344+
...
345+
}
346+
```
347+
289348
## Plugin Usage
290349

291350
With the CodePush plugin downloaded and linked, and your app asking CodePush where to get the right JS bundle from, the only thing left is to add the necessary code to your app to control the following policies:

0 commit comments

Comments
 (0)