Android App White-Labeling

Prev Next

Prerequisites

  • Make sure that you have the requirements outlined in the Mobile App White-Labeling guide.

  • Android Studio (latest stable version).

  • Node.js and yarn.

General setup

Rocket.Chat has build flavors to generate Official and Experimental app versions. To see these flavors, navigate to android > app > src folder. Here you will find the following folders:

  • experimental and official folders contain app icons and splash screens.

  • main folder contains core implementations.

  • debug folder contains code to run the app in debug mode.

To build the Experimental app using experimental, debug, and main folders:

  • Set APPLICATION_ID, VERSIONCODE and BugsnagAPIKey in ./android/gradle.properties.

  • Generate a new image asset for ic_notification and target main.

  • Generate a new image asset for ic_launcher and target experimental.

  • Splash screen uses the same asset as the ic_launcher, and you can change the background on splashBackground.

  • Change the app name and share the extension name on ./android/app/src/main/res/values/strings.xml

Generate upload key

Follow these steps to generate the Keystore for verifying your app on Google Play:

  1. Run the following commands:

    cd android/app
    keytool -genkeypair -v -keystore my-upload-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000

    To learn more about generating an upload key in ReactNative, see the official documentation.

  2. The command prompts you for some credentials.

  3. Set KEYSTORE_PASSWORD and KEY_PASSWORD on ./android/gradle.properties with the passwords you were prompted for.

Generate Android app on Firebase

  1. Go to the project overview on Firebase.

  2. Navigate to Settings > Project settings.

  3. On the General tab, click on Add app under Your apps.

  4. Enter your bundle ID as the Android package name and click Register app.

  5. Download the google-services.json config file and move it to the src folder in the app folder in your project, as demonstrated in the screenshots below:

Run the app

To run the app, execute the following commands:

yarn
yarn android-whitelabel <YOURAPPID>

For example, the app created on this document would use:

yarn android-whitelabel chat.rocket.whitelabel

This script uses experimentalDebug build flavor. When you build your app on release mode, use experimentalRelease. See the Android documentation for more info.