Mobile App Installation

Contribution Guidelines    Edit | Report

Introduction

The Sunbird Mobile app provides mobility to the feature rich learning platform. It provides learners with the flexibility to learn anywhere, anytime and even without an Internet connection.

Build APK from Git Repository

Step Instruction
1. Install Android Studio
Please refer to the official Android documentation for installation instructions.
2. Clone the mobile app source code by executing the below command in console.
git clone https://github.com/project-sunbird/sunbird-android
3. Open the cloned project in Android studio. Rename `gradle.properties.example` to `gradle.properties`
4. Replace the application id in app/build.gradle with implementation specific application id.

Example:
applicationId: "org.implementation.app"
5. Replace redirect base url REDIRECT_BASE_URL and all other base urls with your respective domain name in build.gradle

Example:

buildConfigField 'String', 'REDIRECT_BASE_URL', '"(http or https://domain-name)"'
buildConfigField 'String', 'TELEMETRY_BASE_URL', '"(http or https://domain-name)/api/data/v1"'

6. Replace the producer id PRODUCER_ID for respective environments in gradle.properties as per the format mentioned below
 
"env.implementation-name.app"
 
7. Add your keystore details: keystore, keystore_password, key_alias and key_password in gradle.properties.
Please refer to the official Android documentation for generating a key and keystore.
8. Replace `release_fabric_api_key` in `gradle.properties` with your fabric API Key. Please create an account in fabric.io and register the app to get the API key.
9. Replace PRODUCER_ID, CHANNEL_ID, MOBILE_APP_KEY and MOBILE_APP_SECRET in `gradle.properties` for your dev, release and production build variants
10. Generate the key and secret for mobile_app user using the JWT token of the mobile_admin user. The JWT token for mobile_admin user will be printed on the application server folder /where-you-cloned-sunbird-devops-repo/sunbird-devops/deploy/logs/apis.log.
Please invoke the below API to generate the key and secret for the mobile app:
 
   curl -X POST \
     <your-sunbird-base-url>/api/api-manager/v1/consumer/mobile_app/credential/register \
     -H 'authorization: Bearer <mobile_admin_jwt_token_from_apis_log_file>' \
     -H 'content-type: application/json' \
     -d '{
     "request": {
       "key": "<implementation-name>-mobile-app-<version-number>"
     }
   }'  
Result will be
{"result":{"key":"<implementation-name>-mobile-app-<version-number>","secret":"<secret>"}} Use the value of "key" and "secret" from the response above for MOBILE_APP_KEY and MOBILE_APP_SECRET configuration in respective environments in gradle.properties file. Example:
  
dev_mobile_app_key = "<implementation-name>-mobile-app-<version-number>"
dev_mobile_app_secret = "<secret>" 
  
11. To change the app name, navigate to sunbird-android/app/src/main/res/values/strings.xml and enter the required app name
12. To change the app logo navigate to sunbird-android/app/src/main/res in android studio.
  • In all the mipmap and drawable folders, replace ic_launcher.png image with your desired logo
  • The logo name should exactly match the text ic_launcher.png
  • 13. To show contents only for a specific channel, change the value of FILTER_CONTENT_BY_CHANNEL_ID in build.gradle to true. By default, it is set to false.
    14. Give your external path value in Constants.class EXTERNAL_PATH
    15. Please setup FCM to support announcement feature in mobile app following the Android documentation.

    Edit | Report