0

While integrating code-push in my react-native app using code-push tutorial, i ran following command:

react-native link react-native-code-push

It asked for deployment keys then, which i pasted but now i want to change those keys.

I tried to unlink with the following command but its not working,

react-native unlink react-native-code-push

Can someone please guid me, as i'm new to both react-native and code push?

Awn Ali
  • 1,361
  • 1
  • 17
  • 31

2 Answers2

4

For IOS:

file:

list.info

key:

CodePushDeploymentKey

For Android:

file:

strings.xml

key:

reactNativeCodePush_androidDeploymentKey

update values of these keys and it will work :)

Awn Ali
  • 1,361
  • 1
  • 17
  • 31
  • 6
    How do we add multiple deployment keys for our different environments? E.g Staging, Testing, etc... – James111 Jan 08 '18 at 04:22
  • @James111 You can override the deployment key for different environments by providing options when you wrap a component. See here: https://github.com/microsoft/react-native-code-push#plugin-usage#user-content-dynamic-deployment-assignment – jskidd3 Oct 03 '19 at 18:32
1

So basically deployment keys can be stored in different locations and it depends upon how you have configured the application.

You can always find what is the location of the deployment key the following way:

1) For Android it is injected in MainApplication.java file -> getPackages method (the 1st parameter for CodePush class constructor). By default it should be R.string.reactNativeCodePush_androidDeploymentKey which points exactly to strings.xml file. You can override this if needed and store deployment key in arbitrary place or simply hard-code it here (though it is not recommended).

2) For iOS the default place to store deployment key is Info.plist file located in iOS folder of the application (entry named CodePushDeploymentKey). Later it is extracted by the app in native module in CodePushConfig.m class.

Max Mironov
  • 101
  • 2