React-native-code-push: setup private serverUrl for android

Created on 4 Sep 2019  路  3Comments  路  Source: microsoft/react-native-code-push

Most helpful comment

or do it like this, set postinstall in your project's package.json file.

...
 "scripts": {
    "postinstall": "sed -ig 's/new CodePush(getResources().getString(R.string.reactNativeCodePush_androidDeploymentKey), getApplicationContext(), BuildConfig.DEBUG)/new CodePush(getResources().getString(R.string.reactNativeCodePush_androidDeploymentKey), getApplicationContext(), BuildConfig.DEBUG, "YOUR_SERVER_URL")/g' node_modules/react-native-code-push/package.json",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
...

All 3 comments

because the readme does not mention how to setup the private serverUrl , so I try to find out where is the problem block working .
ohh , I forgot the serverUrl
1銆乤ndroid/app/src/main/res/values/strings.xml
add <string moduleConfig="true" name="serverUrl">https://xxx.com</string>
2銆乶ode_modules/react-native-code-push/package.json
add BuildConfig.DEBUG,getResources().getString(R.string.serverUrl) to the new CodePush func.
like this below
"rnpm": {
"android": {
"packageInstance": "new CodePush(getResources().getString(R.string.reactNativeCodePush_androidDeploymentKey), getApplicationContext(), BuildConfig.DEBUG,getResources().getString(R.string.serverUrl))"
}

cool!

because the readme does not mention how to setup the private serverUrl , so I try to find out where is the problem block working .
ohh , I forgot the serverUrl
1銆乤ndroid/app/src/main/res/values/strings.xml
add <string moduleConfig="true" name="serverUrl">https://xxx.com</string>
2銆乶ode_modules/react-native-code-push/package.json
add BuildConfig.DEBUG,getResources().getString(R.string.serverUrl) to the new CodePush func.
like this below
"rnpm": {
"android": {
"packageInstance": "new CodePush(getResources().getString(R.string.reactNativeCodePush_androidDeploymentKey), getApplicationContext(), BuildConfig.DEBUG,getResources().getString(R.string.serverUrl))"
}

cool!

or do it like this, set postinstall in your project's package.json file.

...
 "scripts": {
    "postinstall": "sed -ig 's/new CodePush(getResources().getString(R.string.reactNativeCodePush_androidDeploymentKey), getApplicationContext(), BuildConfig.DEBUG)/new CodePush(getResources().getString(R.string.reactNativeCodePush_androidDeploymentKey), getApplicationContext(), BuildConfig.DEBUG, "YOUR_SERVER_URL")/g' node_modules/react-native-code-push/package.json",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
...
Was this page helpful?
0 / 5 - 0 ratings

Related issues

panarasi picture panarasi  路  4Comments

Phredward picture Phredward  路  3Comments

ACCTFORGH picture ACCTFORGH  路  3Comments

vira-khdr picture vira-khdr  路  3Comments

Fuhrmann picture Fuhrmann  路  3Comments