Skip to content

Instantly share code, notes, and snippets.

@hemanth-manoharan
Last active June 25, 2022 07:00
Show Gist options
  • Save hemanth-manoharan/5460456f019faae2678776427f879bac to your computer and use it in GitHub Desktop.
Save hemanth-manoharan/5460456f019faae2678776427f879bac to your computer and use it in GitHub Desktop.

Revisions

  1. hemanth-manoharan revised this gist Jun 25, 2022. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions electrode-native-helloworld3.md
    Original file line number Diff line number Diff line change
    @@ -104,7 +104,11 @@ ElectrodeReactContainer.initialize(

    `ERN_LOG_LEVEL=debug ern code-push release --miniapps [email protected] -d ErnOuterApp:android:0.0.1 --deploymentName Staging`

    - If the code-push command fails due to an internal server error as below, then proceed further.
    - To apply the update immediately, make it a mandatory update via AppCenter portal.

    - Now, finally run the app and check if the update happens.

    - If the code-push command fails due to an internal server error as below, then follow the steps indicated.

    ```
    [ Releasing bundle through CodePush (Started) ]
    @@ -126,6 +130,4 @@ We are interested in the `bundleOut` folder under the same.

    `appcenter codepush release -a hemanth-aero-pmdp/ErnOuterAppAndroid -c TEMP_FOLDER_PATH/bundleOut -t 0.0.1 -d Staging`

    - To apply the update immediately, make it a mandatory update via AppCenter portal.

    - Now, finally run the app and check if the update happens.
  2. hemanth-manoharan revised this gist Jan 9, 2021. 1 changed file with 1 addition and 4 deletions.
    5 changes: 1 addition & 4 deletions electrode-native-helloworld3.md
    Original file line number Diff line number Diff line change
    @@ -96,10 +96,7 @@ ElectrodeReactContainer.initialize(

    - Run the commands

    ```
    ern cauldron update miniapps [email protected] -d ErnOuterApp:android:0.0.1 -v 1.0.3
    ern create-container -d ErnOuterApp:android:0.0.1 -p android
    ```
    `ern cauldron update miniapps [email protected] -d ErnOuterApp:android:0.0.1 -v 1.0.3`

    - **Important**: Ensure that the `versionName` in the app's `build.gradle` for `ErnOuterApp` has the right version `"0.0.1"`

  3. hemanth-manoharan revised this gist Jan 7, 2021. 1 changed file with 22 additions and 18 deletions.
    40 changes: 22 additions & 18 deletions electrode-native-helloworld3.md
    Original file line number Diff line number Diff line change
    @@ -10,16 +10,22 @@ It assumes that one has already completed the steps in Tutorial #2 here - https:

    - Follow the steps at https://docs.microsoft.com/en-us/appcenter/distribution/codepush/migrationguide to create an app named `ErnOuterAppAndroid` in AppCenter. The naming convention is important where the name of the native app in Cauldron is `ErnOuterApp`

    `appcenter apps create -p "React-Native" -o "Android" -d ErnOuterAppAndroid`
    ```
    npm install -g appcenter-cli
    appcenter login
    appcenter apps create -p "React-Native" -o "Android" -d ErnOuterAppAndroid
    ```

    - From the AppCenter portal, create the default deployments for that app (Staging and Production). Retrieve the CodePush deployment keys for the app using the following command. Keep a note of the key against `Staging` deployment.
    - From the AppCenter portal, create the default deployments for that app (Staging and Production).

    - Then, retrieve the CodePush deployment keys for the app using the following command. Keep a note of the key against `Staging` deployment.

    `appcenter codepush deployment list -a hemanth-aero-pmdp/ErnOuterAppAndroid -k`

    - Now, run the following to locally setup the CodePush deployment key for `Staging` noted in the previous step
    **TODO** Here, we need to set the Code Push API Access Token and not Deployment Key
    - Now, run the following to locally setup the CodePush API Access token with Electrode Native
    **Note**: Here, we need to set the Code Push API Access Token and not Deployment Key

    `ern platform config set codePushAccessKey YOUR_CODE_PUSH_ACCESS_KEY`
    `ern platform config set codePushAccessKey YOUR_CODE_PUSH_API_ACCESS_TOKEN`

    - Now, let's move to `app1-miniapp` folder (the app for which we want to push OTA update) and perform the following steps

    @@ -55,23 +61,20 @@ export default App;

    ## Section - Publish an updated version of app1 simply and embed the aar within ErnOuterApp to get access to CodePushPlugin class in tbe native Android code

    - Now, update the version in `package.json` of `app1-miniapp` to `0.0.3` and re-publish the same to npm
    - Now, update the version in `package.json` of `app1-miniapp` to `0.0.2` and re-publish the same to npm

    - Now, update the cauldron with the new version of app1.
    **Note**: We are choosing not to update the native app version in this case but we are bumping up the container version.

    `ern cauldron update miniapps [email protected] -d ErnOuterApp:android:0.0.1 -v 1.0.3`
    `ern cauldron update miniapps [email protected] -d ErnOuterApp:android:0.0.1 -v 1.0.2`

    - Now, create the container locally again using the cauldron metadata. Then, publish the same.
    - Now, create the container locally again using the cauldron metadata.

    ```
    ern create-container -d ErnOuterApp:android:0.0.1 -p android
    ern publish-container -p git --platform android -u https://github.com/hemanth-manoharan/app1-app2-miniapp-container.git -v 1.0.3
    ```
    `ern create-container -d ErnOuterApp:android:0.0.1 -p android`

    - Now, sync the published repo and run the gradle build to create the updated .aar file.
    - Now, run the gradle build to create the updated .aar file.

    - Then, copy over the updated lib-debug.aar to the libs folder of the ErnOuterApp android project
    - Then, copy over the updated `lib-debug.aar` to the `libs` folder of the ErnOuterApp android project

    - Change the initialization code in the `ErnOuterApp` as follows

    @@ -89,19 +92,20 @@ ElectrodeReactContainer.initialize(

    ## Section - Finally, pushing an OTA update for app1

    - First, make some change in `app1-miniapp`, update the version in `package.json` to `0.0.4` and re-publish the same to npm
    - First, make some change in `app1-miniapp`, update the version in `package.json` to `0.0.3` and re-publish the same to npm

    - Run the commands

    ```
    ern cauldron update miniapps [email protected].4 -d ErnOuterApp:android:0.0.1 -v 1.0.4
    ern cauldron update miniapps [email protected].3 -d ErnOuterApp:android:0.0.1 -v 1.0.3
    ern create-container -d ErnOuterApp:android:0.0.1 -p android
    ern publish-container -p git --platform android -u https://github.com/hemanth-manoharan/app1-app2-miniapp-container.git -v 1.0.4
    ```

    - **Important**: Ensure that the `versionName` in the app's `build.gradle` for `ErnOuterApp` has the right version `"0.0.1"`

    - Now, let's use CodePush to dynamically push the OTA update

    `ERN_LOG_LEVEL=debug ern code-push release --miniapps [email protected].4 -d ErnOuterApp:android:0.0.1 --deploymentName Staging`
    `ERN_LOG_LEVEL=debug ern code-push release --miniapps [email protected].3 -d ErnOuterApp:android:0.0.1 --deploymentName Staging`

    - If the code-push command fails due to an internal server error as below, then proceed further.

  4. hemanth-manoharan revised this gist Jan 1, 2021. 1 changed file with 3 additions and 13 deletions.
    16 changes: 3 additions & 13 deletions electrode-native-helloworld3.md
    Original file line number Diff line number Diff line change
    @@ -97,6 +97,7 @@ ern cauldron update miniapps [email protected] -d ErnOuterApp:android:0.0.1 -v
    ern create-container -d ErnOuterApp:android:0.0.1 -p android
    ern publish-container -p git --platform android -u https://github.com/hemanth-manoharan/app1-app2-miniapp-container.git -v 1.0.4
    ```
    - **Important**: Ensure that the `versionName` in the app's `build.gradle` for `ErnOuterApp` has the right version `"0.0.1"`

    - Now, let's use CodePush to dynamically push the OTA update

    @@ -120,21 +121,10 @@ Error: {"message":"Internal Server Error","statusCode":500}

    We are interested in the `bundleOut` folder under the same.

    **TODO REPEAT STEPS FROM HERE**

    - Then, run the following command directly

    `appcenter codepush release -a hemanth-aero-pmdp/ErnOuterAppAndroid -c TEMP_FOLDER_PATH/bundleOut -t 0.0.1 -d Staging`

    **TODO** Seeing this error on application startup.

    ```
    D/ReactNative: [CodePush] Unable to get the hash of the binary's bundled resources - "codepush.gradle" may have not been added to the build definition.
    ```

    **TODO** Should we use release-react instead?

    - Change directory to the temporary folder (same folder where `package.json` resides) for running this ...
    https://docs.microsoft.com/en-gb/appcenter/distribution/codepush/cli#releasing-updates
    - To apply the update immediately, make it a mandatory update via AppCenter portal.

    **TODO** Is the crash in back button press affecting the update behaviour? Need to investigate.
    - Now, finally run the app and check if the update happens.
  5. hemanth-manoharan revised this gist Jan 1, 2021. 1 changed file with 8 additions and 2 deletions.
    10 changes: 8 additions & 2 deletions electrode-native-helloworld3.md
    Original file line number Diff line number Diff line change
    @@ -126,9 +126,15 @@ We are interested in the `bundleOut` folder under the same.

    `appcenter codepush release -a hemanth-aero-pmdp/ErnOuterAppAndroid -c TEMP_FOLDER_PATH/bundleOut -t 0.0.1 -d Staging`

    **TODO** Seeing this error on application startup.

    ```
    D/ReactNative: [CodePush] Unable to get the hash of the binary's bundled resources - "codepush.gradle" may have not been added to the build definition.
    ```

    **TODO** Should we use release-react instead?

    - Change directory to the temporary folder (same folder where `package.json` resides) for running this ...
    https://docs.microsoft.com/en-gb/appcenter/distribution/codepush/cli#releasing-updates

    **TODO** Is the crash in back button press affecting the update behaviour?
    Need to investigate.
    **TODO** Is the crash in back button press affecting the update behaviour? Need to investigate.
  6. hemanth-manoharan revised this gist Jan 1, 2021. 1 changed file with 5 additions and 3 deletions.
    8 changes: 5 additions & 3 deletions electrode-native-helloworld3.md
    Original file line number Diff line number Diff line change
    @@ -118,15 +118,17 @@ Error: {"message":"Internal Server Error","statusCode":500}

    `/private/var/folders/*`

    We are interested in the `bundleOut` folder under the same.

    **TODO REPEAT STEPS FROM HERE**
    - Change directory to the temporary folder (same folder where `package.json` resides)

    - Then, run the following command directly

    `appcenter codepush release -a hemanth-aero-pmdp/ErnOuterAppAndroid -c TEMP_FOLDER_PATH -t 0.0.1 -d Staging`
    `appcenter codepush release -a hemanth-aero-pmdp/ErnOuterAppAndroid -c TEMP_FOLDER_PATH/bundleOut -t 0.0.1 -d Staging`

    **TODO** Should we use release-react instead?
    - Change directory to the temporary folder (same folder where `package.json` resides) for running this ...
    https://docs.microsoft.com/en-gb/appcenter/distribution/codepush/cli#releasing-updates

    **TODO** Is the crash in back button press affecting the update behaviour?
    Need to investigate.
    Need to investigate.
  7. hemanth-manoharan revised this gist Jan 1, 2021. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion electrode-native-helloworld3.md
    Original file line number Diff line number Diff line change
    @@ -126,5 +126,7 @@ Error: {"message":"Internal Server Error","statusCode":500}
    `appcenter codepush release -a hemanth-aero-pmdp/ErnOuterAppAndroid -c TEMP_FOLDER_PATH -t 0.0.1 -d Staging`

    **TODO** Should we use release-react instead?
    https://docs.microsoft.com/en-gb/appcenter/distribution/codepush/cli#releasing-updates

    https://docs.microsoft.com/en-gb/appcenter/distribution/codepush/cli#releasing-updates
    **TODO** Is the crash in back button press affecting the update behaviour?
    Need to investigate.
  8. hemanth-manoharan revised this gist Jan 1, 2021. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion electrode-native-helloworld3.md
    Original file line number Diff line number Diff line change
    @@ -123,4 +123,8 @@ Error: {"message":"Internal Server Error","statusCode":500}

    - Then, run the following command directly

    `appcenter codepush release-react -a hemanth-aero-pmdp/ErnOuterAppAndroid -c TEMP_FOLDER_PATH -t 0.0.1 -d Staging`
    `appcenter codepush release -a hemanth-aero-pmdp/ErnOuterAppAndroid -c TEMP_FOLDER_PATH -t 0.0.1 -d Staging`

    **TODO** Should we use release-react instead?

    https://docs.microsoft.com/en-gb/appcenter/distribution/codepush/cli#releasing-updates
  9. hemanth-manoharan revised this gist Jan 1, 2021. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion electrode-native-helloworld3.md
    Original file line number Diff line number Diff line change
    @@ -119,7 +119,8 @@ Error: {"message":"Internal Server Error","statusCode":500}
    `/private/var/folders/*`

    **TODO REPEAT STEPS FROM HERE**
    - Change directory to the temporary folder (same folder where `package.json` resides)

    - Then, run the following command directly

    `appcenter codepush release -a hemanth-aero-pmdp/ErnOuterAppAndroid -c TEMP_FOLDER_PATH -t 0.0.1 -d Staging`
    `appcenter codepush release-react -a hemanth-aero-pmdp/ErnOuterAppAndroid -c TEMP_FOLDER_PATH -t 0.0.1 -d Staging`
  10. hemanth-manoharan revised this gist Jan 1, 2021. 1 changed file with 2 additions and 3 deletions.
    5 changes: 2 additions & 3 deletions electrode-native-helloworld3.md
    Original file line number Diff line number Diff line change
    @@ -92,9 +92,6 @@ ElectrodeReactContainer.initialize(
    - First, make some change in `app1-miniapp`, update the version in `package.json` to `0.0.4` and re-publish the same to npm

    - Run the commands

    **TODO REPEAT STEPS FROM HERE**

    ```
    ern cauldron update miniapps [email protected] -d ErnOuterApp:android:0.0.1 -v 1.0.4
    ern create-container -d ErnOuterApp:android:0.0.1 -p android
    @@ -121,6 +118,8 @@ Error: {"message":"Internal Server Error","statusCode":500}

    `/private/var/folders/*`

    **TODO REPEAT STEPS FROM HERE**

    - Then, run the following command directly

    `appcenter codepush release -a hemanth-aero-pmdp/ErnOuterAppAndroid -c TEMP_FOLDER_PATH -t 0.0.1 -d Staging`
  11. hemanth-manoharan revised this gist Dec 31, 2020. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions electrode-native-helloworld3.md
    Original file line number Diff line number Diff line change
    @@ -91,6 +91,16 @@ ElectrodeReactContainer.initialize(

    - First, make some change in `app1-miniapp`, update the version in `package.json` to `0.0.4` and re-publish the same to npm

    - Run the commands

    **TODO REPEAT STEPS FROM HERE**

    ```
    ern cauldron update miniapps [email protected] -d ErnOuterApp:android:0.0.1 -v 1.0.4
    ern create-container -d ErnOuterApp:android:0.0.1 -p android
    ern publish-container -p git --platform android -u https://github.com/hemanth-manoharan/app1-app2-miniapp-container.git -v 1.0.4
    ```

    - Now, let's use CodePush to dynamically push the OTA update

    `ERN_LOG_LEVEL=debug ern code-push release --miniapps [email protected] -d ErnOuterApp:android:0.0.1 --deploymentName Staging`
  12. hemanth-manoharan revised this gist Dec 31, 2020. 1 changed file with 20 additions and 10 deletions.
    30 changes: 20 additions & 10 deletions electrode-native-helloworld3.md
    Original file line number Diff line number Diff line change
    @@ -17,6 +17,7 @@ It assumes that one has already completed the steps in Tutorial #2 here - https:
    `appcenter codepush deployment list -a hemanth-aero-pmdp/ErnOuterAppAndroid -k`

    - Now, run the following to locally setup the CodePush deployment key for `Staging` noted in the previous step
    **TODO** Here, we need to set the Code Push API Access Token and not Deployment Key

    `ern platform config set codePushAccessKey YOUR_CODE_PUSH_ACCESS_KEY`

    @@ -92,15 +93,24 @@ ElectrodeReactContainer.initialize(

    - Now, let's use CodePush to dynamically push the OTA update

    `ern code-push release --miniapps [email protected] -d ErnOuterApp:android:0.0.1 --deploymentName Staging`
    `ERN_LOG_LEVEL=debug ern code-push release --miniapps [email protected] -d ErnOuterApp:android:0.0.1 --deploymentName Staging`

    **TO DEBUG** The code-push command gives this error
    - If the code-push command fails due to an internal server error as below, then proceed further.

    ```
    [ Releasing bundle through CodePush (Started) ]
    [ Releasing bundle through CodePush (Failed) ]
    ✖ performCodePushOtaUpdate Error: {"message":"Internal Server Error","statusCode":500}
    ✖ An error occurred: {"message":"Internal Server Error","statusCode":500}
    Error: {"message":"Internal Server Error","statusCode":500}
    at CodePushSdk.releaseReact (/Users/hemanth/.ern/versions/0.45.5/node_modules/ern-core/src/CodePushSdk.ts:73:15)
    at processTicksAndRejections (node:internal/process/task_queues:93:5)
    ```
    ✖ Releasing bundle through CodePush 8s
    ✖ performCodePushOtaUpdate Error: {"message":"A valid authorization header is missing from the request; please run \"code-pus
    h login\" again. If you are on an older version of the CLI, you may need to run \"code-push logout\" first to clear the sessi
    on cache.","statusCode":403}
    ✖ An error occurred: {"message":"A valid authorization header is missing from the request; please run \"code-push login\" aga
    in. If you are on an older version of the CLI, you may need to run \"code-push logout\" first to clear the session cache.","s
    tatusCode":403}
    ```

    - Note down the temporary folder path like the one below in the output of the above command

    `/private/var/folders/*`

    - Then, run the following command directly

    `appcenter codepush release -a hemanth-aero-pmdp/ErnOuterAppAndroid -c TEMP_FOLDER_PATH -t 0.0.1 -d Staging`
  13. hemanth-manoharan revised this gist Dec 31, 2020. 1 changed file with 12 additions and 1 deletion.
    13 changes: 12 additions & 1 deletion electrode-native-helloworld3.md
    Original file line number Diff line number Diff line change
    @@ -92,4 +92,15 @@ ElectrodeReactContainer.initialize(

    - Now, let's use CodePush to dynamically push the OTA update

    `ern code-push release --miniapps [email protected] -d ErnOuterApp:android:0.0.1 --deploymentName Staging`
    `ern code-push release --miniapps [email protected] -d ErnOuterApp:android:0.0.1 --deploymentName Staging`

    **TO DEBUG** The code-push command gives this error
    ```
    ✖ Releasing bundle through CodePush 8s
    ✖ performCodePushOtaUpdate Error: {"message":"A valid authorization header is missing from the request; please run \"code-pus
    h login\" again. If you are on an older version of the CLI, you may need to run \"code-push logout\" first to clear the sessi
    on cache.","statusCode":403}
    ✖ An error occurred: {"message":"A valid authorization header is missing from the request; please run \"code-push login\" aga
    in. If you are on an older version of the CLI, you may need to run \"code-push logout\" first to clear the session cache.","s
    tatusCode":403}
    ```
  14. hemanth-manoharan revised this gist Dec 31, 2020. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions electrode-native-helloworld3.md
    Original file line number Diff line number Diff line change
    @@ -88,4 +88,8 @@ ElectrodeReactContainer.initialize(

    ## Section - Finally, pushing an OTA update for app1

    - First, make some change in `app1-miniapp`, update the version in `package.json` to `0.0.4` and re-publish the same to npm

    - Now, let's use CodePush to dynamically push the OTA update

    `ern code-push release --miniapps [email protected] -d ErnOuterApp:android:0.0.1 --deploymentName Staging`
  15. hemanth-manoharan revised this gist Dec 31, 2020. 1 changed file with 10 additions and 6 deletions.
    16 changes: 10 additions & 6 deletions electrode-native-helloworld3.md
    Original file line number Diff line number Diff line change
    @@ -70,11 +70,7 @@ ern publish-container -p git --platform android -u https://github.com/hemanth-ma

    - Now, sync the published repo and run the gradle build to create the updated .aar file.

    Then, copy over the updated lib-debug.aar to the libs folder of the ErnOuterApp android project

    Then, test out the app with both the buttons and check if things are fine.

    ## Section - Adding CodePushPlugin changes to the native Android code
    - Then, copy over the updated lib-debug.aar to the libs folder of the ErnOuterApp android project

    - Change the initialization code in the `ErnOuterApp` as follows

    @@ -84,4 +80,12 @@ ElectrodeReactContainer.initialize(
    new ElectrodeReactContainer.Config(),
    new CodePushPlugin.Config("DEPLOYMENT_KEY")
    /* Additional plugins configuration here */);
    ```
    ```

    - Then, test out the app with both the buttons and check if things are fine.

    - At this point - we are all set for pushing OTA updates for non-native changes to app1. Let's do that in the next section.

    ## Section - Finally, pushing an OTA update for app1


  16. hemanth-manoharan revised this gist Dec 31, 2020. 1 changed file with 17 additions and 12 deletions.
    29 changes: 17 additions & 12 deletions electrode-native-helloworld3.md
    Original file line number Diff line number Diff line change
    @@ -26,16 +26,20 @@ It assumes that one has already completed the steps in Tutorial #2 here - https:

    `ern add react-native-code-push`

    - Then, in the app1-miniapp code, decorate the `App` Component class in `App.js` with codePush as shown below
    - Then, in the app1-miniapp code, decorate the `App` Component class in `App.js` with codePush as shown below.
    To decorate the same with codePush, the component needs to be defined as a Class Component. Not a Function Component.

    ```
    import codePush from 'react-native-code-push';
    ...
    const App: () => React$Node = () => {
    ...
    };
    // const App: () => React$Node = () => {
    class App extends React.Component {
    render() {
    ...
    }
    }
    ...
    @@ -48,20 +52,20 @@ App = codePush({
    export default App;
    ```

    ## Section - Publish an updated version of app1 simply and embed the aar within ErnOuterApp to get access to CodePushPlugin in tbe native Android code
    ## Section - Publish an updated version of app1 simply and embed the aar within ErnOuterApp to get access to CodePushPlugin class in tbe native Android code

    - Now update the version in `package.json` of `app1-miniapp` to `0.0.2` and re-publish the same to npm
    - Now, update the version in `package.json` of `app1-miniapp` to `0.0.3` and re-publish the same to npm

    - Now, update the cauldron with the new version of app1.
    **Note**: We are choosing not to update the native app version in this case but we are bumping up the container version.

    `ern cauldron update miniapps [email protected].2 -d ErnOuterApp:android:0.0.1 -v 1.0.2`
    `ern cauldron update miniapps [email protected].3 -d ErnOuterApp:android:0.0.1 -v 1.0.3`

    - Now, create the container locally again using the cauldron metadata. Then, publish the same.

    ```
    ern create-container -d ErnOuterApp:android:0.0.1 -p android
    ern publish-container -p git --platform android -u https://github.com/hemanth-manoharan/app1-app2-miniapp-container.git -v 1.0.2
    ern publish-container -p git --platform android -u https://github.com/hemanth-manoharan/app1-app2-miniapp-container.git -v 1.0.3
    ```

    - Now, sync the published repo and run the gradle build to create the updated .aar file.
    @@ -70,13 +74,14 @@ Then, copy over the updated lib-debug.aar to the libs folder of the ErnOuterApp

    Then, test out the app with both the buttons and check if things are fine.

    ## Section - Adding CodePush changes to the native Android code
    ## Section - Adding CodePushPlugin changes to the native Android code

    - Change the initialization code in the `ErnOuterApp` as follows

    ```
    ElectrodeReactContainer.initialize(
    new CodePushPlugin.Config("DEPLOYMENT_KEY")
    // [...]
    );
    getApplication() /* Application instance */,
    new ElectrodeReactContainer.Config(),
    new CodePushPlugin.Config("DEPLOYMENT_KEY")
    /* Additional plugins configuration here */);
    ```
  17. hemanth-manoharan revised this gist Dec 31, 2020. 1 changed file with 38 additions and 1 deletion.
    39 changes: 38 additions & 1 deletion electrode-native-helloworld3.md
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,7 @@ It assumes that one has already completed the steps in Tutorial #2 here - https:

    `appcenter apps create -p "React-Native" -o "Android" -d ErnOuterAppAndroid`

    - Retrieve the CodePush deployment keys for the app using the following command. Keep a note of the key against `Staging` deployment.
    - From the AppCenter portal, create the default deployments for that app (Staging and Production). Retrieve the CodePush deployment keys for the app using the following command. Keep a note of the key against `Staging` deployment.

    `appcenter codepush deployment list -a hemanth-aero-pmdp/ErnOuterAppAndroid -k`

    @@ -30,16 +30,53 @@ It assumes that one has already completed the steps in Tutorial #2 here - https:

    ```
    import codePush from 'react-native-code-push';
    ...
    const App: () => React$Node = () => {
    ...
    };
    ...
    App = codePush({
    checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
    installMode: codePush.InstallMode.ON_NEXT_RESUME,
    minimumBackgroundDuration: 60 * 2,
    })(App)
    export default App;
    ```

    ## Section - Publish an updated version of app1 simply and embed the aar within ErnOuterApp to get access to CodePushPlugin in tbe native Android code

    - Now update the version in `package.json` of `app1-miniapp` to `0.0.2` and re-publish the same to npm

    - Now, update the cauldron with the new version of app1.
    **Note**: We are choosing not to update the native app version in this case but we are bumping up the container version.

    `ern cauldron update miniapps [email protected] -d ErnOuterApp:android:0.0.1 -v 1.0.2`

    - Now, create the container locally again using the cauldron metadata. Then, publish the same.

    ```
    ern create-container -d ErnOuterApp:android:0.0.1 -p android
    ern publish-container -p git --platform android -u https://github.com/hemanth-manoharan/app1-app2-miniapp-container.git -v 1.0.2
    ```

    - Now, sync the published repo and run the gradle build to create the updated .aar file.

    Then, copy over the updated lib-debug.aar to the libs folder of the ErnOuterApp android project

    Then, test out the app with both the buttons and check if things are fine.

    ## Section - Adding CodePush changes to the native Android code

    - Change the initialization code in the `ErnOuterApp` as follows

    ```
    ElectrodeReactContainer.initialize(
    new CodePushPlugin.Config("DEPLOYMENT_KEY")
    // [...]
    );
    ```
  18. hemanth-manoharan revised this gist Dec 31, 2020. 1 changed file with 33 additions and 2 deletions.
    35 changes: 33 additions & 2 deletions electrode-native-helloworld3.md
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,38 @@ It assumes that one has already completed the steps in Tutorial #2 here - https:

    - In this tutorial, we are going to release code updates over the air to existing mini-apps, to released native application versions.

    - Follow the steps at https://docs.microsoft.com/en-us/appcenter/distribution/codepush/migrationguide to create an app named `ErnOuterApp` in AppCenter
    - Follow the steps at https://docs.microsoft.com/en-us/appcenter/distribution/codepush/migrationguide to create an app named `ErnOuterAppAndroid` in AppCenter. The naming convention is important where the name of the native app in Cauldron is `ErnOuterApp`

    `appcenter apps create -d ErnOuterApp -o Android -p React-Native`
    `appcenter apps create -p "React-Native" -o "Android" -d ErnOuterAppAndroid`

    - Retrieve the CodePush deployment keys for the app using the following command. Keep a note of the key against `Staging` deployment.

    `appcenter codepush deployment list -a hemanth-aero-pmdp/ErnOuterAppAndroid -k`

    - Now, run the following to locally setup the CodePush deployment key for `Staging` noted in the previous step

    `ern platform config set codePushAccessKey YOUR_CODE_PUSH_ACCESS_KEY`

    - Now, let's move to `app1-miniapp` folder (the app for which we want to push OTA update) and perform the following steps

    - Run the command

    `ern add react-native-code-push`

    - Then, in the app1-miniapp code, decorate the `App` Component class in `App.js` with codePush as shown below

    ```
    import codePush from 'react-native-code-push';
    ...
    const App: () => React$Node = () => {
    ...
    };
    ...
    App = codePush({
    checkFrequency: codePush.CheckFrequency.ON_APP_RESUME,
    installMode: codePush.InstallMode.ON_NEXT_RESUME,
    minimumBackgroundDuration: 60 * 2,
    })(App)
    export default App;
    ```
  19. hemanth-manoharan revised this gist Dec 31, 2020. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion electrode-native-helloworld3.md
    Original file line number Diff line number Diff line change
    @@ -4,4 +4,11 @@ This post is the 3rd one in a series of posts on Electrode Native.

    It assumes that one has already completed the steps in Tutorial #2 here - https://gist.github.com/hemanth-manoharan/8c0f5bda0469335ce9410ea61dbc4e54

    **TODO** https://native.electrode.io/cli-commands/code-push#prerequisites
    **Ref**: https://native.electrode.io/cli-commands/code-push#prerequisites

    - In this tutorial, we are going to release code updates over the air to existing mini-apps, to released native application versions.

    - Follow the steps at https://docs.microsoft.com/en-us/appcenter/distribution/codepush/migrationguide to create an app named `ErnOuterApp` in AppCenter

    `appcenter apps create -d ErnOuterApp -o Android -p React-Native`

  20. hemanth-manoharan created this gist Dec 31, 2020.
    7 changes: 7 additions & 0 deletions electrode-native-helloworld3.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    # Tutorial #3: How to perform OTA (Over-The-Air) updates using CodePush

    This post is the 3rd one in a series of posts on Electrode Native.

    It assumes that one has already completed the steps in Tutorial #2 here - https://gist.github.com/hemanth-manoharan/8c0f5bda0469335ce9410ea61dbc4e54

    **TODO** https://native.electrode.io/cli-commands/code-push#prerequisites