Setting Up Mobile App

Edit | Report

Introduction

The Sunbird Mobile app provides mobility to its feature-rich learning platform. It provides learners with the flexibility to learn anywhere, anytime.

Prerequisites


1.To set up Sunbird mobile app, ensure you have installed the following:
 a) NPM Version - 3.5.2
 b) Node JS Version - above 6
 c) Cordova Version - 8.0.0
 d) Ionic Version - 3.20.0
2. Generate the key and secret for the 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.

Generating Secret: Execute the listed API to generate the key and secret for the mobile app:

curl -X POST \ /api/api-manager/v1/consumer/mobile_app/credential/register \ -H 'authorization: Bearer ' \ -H 'content-type: application/json' \ -d '{ "request": { "key": "-mobile-app-" } }'

Response body:

{“result”:{“key”:”-mobile-app-","secret":""}}

Use the key and secret from the response given for MOBILE_APP_KEY and MOBILE_APP_SECRET configuration in respective environments in gradle.properties file. Example:

**dev_mobile_app_key = “-mobile-app-" dev_mobile_app_secret = ""**

Producer Key

Replace the producer id PRODUCER_ID for respective environments in sunbird.properties.

Fabric credentials:

Replace release_fabric_api_key in sunbird.properties with your fabric API Key. Create an account in fabric.io and register in the app to get the API key.

Build APK from Git Repository

Sunbird mobile app can be built from the main source code which is available at project-sunbird/sunbird-mobile.

Sample properties file is located inside buildConfig folder. This has to be renamed to sunbird.properties and appropriate values should be provided.

Customising App Configuration

Instance admin of Sunbird adopters can configure various aspects of the Sunbird mobile app based on the requirement of the the organization. The admin are able to configure various aspects such as:

  • App name
  • App logo
  • Login/Guest page to new users
  • Sign in footer card on the app
  • Onboarding cards
  • Categories in the profile page
S No. Variable Name Description Purpose Default Value
1 appId the app id in sunbird-mobile/config.xml with implementation specific application ID To change the app ID appId: “org.sunbird.app”
2 app name navigate to sunbird-mobile/config.xml and enter the required app name To change the app name  
3 app logo navigate to sunbird-mobile/resources/android/icon and sunbird-mobile/resources/android/splash. In all the mipmap and drawable folders, replace ic_launcher.png image with your desired logo. The logo name should exactly match the text drawable-ldpi-icon.png To change the app logo  
4 app Set the configuration variable inside the sunbird-mobile repo inside buildConfig folder    
5 app version code Version code for the app release To customize the end points in the app Replace redirect base url REDIRECT_BASE_URL and all other base urls with your respective domain name in sunbird.properties
6 deep link schema This plugin handles deeplinks on iOS and Android for both custom URL scheme links and Universal App Links. Deep link schema can be changed from sunbird.properties Change the “dev_deeplink_base_url = dev.open-sunbird.org” to the required name  
7 display_onboarding_page set the configuration variable inside the sunbird-mobile repo inside buildConfig folder to display the onboarding page false
8 display_signin_footer_card_in_course_tab_for_teacher set the display_signin_footer_card_in_course_tab_for_teachervariable as true in sunbird.properties file to show the sign-in footer in the course tab for teachers false
9 display_signin_footer_card_in_library_tab_for_teacher Set the display_signin_footer_card_in_library_tab_for_teacher variable true in sunbird.properties file to show the sign-in footer in the library tab for teachers false
10 display_signin_footer_card_in_profile_tab_for_teacher Set the display_signin_footer_card_in_profile_tab_for_teacheras true in sunbird.properties file to show the sign-in footer in the profile tab for teachers false
11 display_signin_footer_card_in_profile_tab_for_student Set the display_signin_footer_card_in_profile_tab_for_studentas true in sunbird.properties file to show the sign-in footer in the profile tab for students false
12 display_signin_footer_card_in_library_tab_for_student Set the display_signin_footer_card_in_library_tab_for_studentas true in sunbird.properties file to show the sign-in footer in the profile tab for students false
13 display_onboarding_card set the display__onboarding_cards as true in sunbird.properties file to display the guest/login page false
14 display_framework_categories_in_profile set the display_framework_categories_in_profile variable as true in sunbird.properties file to display categories in the guest/login page false

Packaging Framework and Form Data Sunbird mobile app supports configuration of the app framework to enable offline usage of the app. To configure the app framework, adopter needs to package the channel for the respective framework. Details of the file naming convention and folder location are given below:

S No. Folder File Name Purpose
1 buildConfig/data/framework framework-.json To package the channel for the respective framework. Same framework must be listed in the onboarding form API
2 buildConfig/data/channel channel-.json To package the channel. Default framework must be same as the packaged framework for respective channel
3 buildConfig/data/form syllabus.json To onboard form API
4 buildConfig/data/form pageassemble_course_filter.json Page assemble filter for course
5 buildConfig/data/form pageassemble_library_filter.json Page assemble filter for library

Installing Individual Plugins

Sunbird is an open source, configurable, extendable, modular learning management platform architected for scale and designed to support multiple teaching and learning solutions supporting multiple languages and available for online and offline use. Various plugins are utilized to meet this objective. Adopters can choose and intall plugins to customize the application to suit their business needs. This ection details the procedure for installing inidividual plugins for the mobile application.

Genie-sdk-wrapper

This repository contains common services, and global UI pages required in an app. The services internally call to the cordova plugins. All the http and database related API goes through this npm module.

To generate local node module:

Cordova-plugin-genie-sdk

This is a cordova plugin for android. IT exposes some API’s that internally calls to the genie services.

Cordova-plugin-sunbirdsplash

This plugin displays and hides a splash screen during application launch. To change the splash screen and splash image, go to sunbird-mobile/resources/android/splash and update the drawable-ldpi-splash.png

To update your required splash.png file and sunbird-mobile/resources/android/icon update drawable-ldpi-icon.png ** to your required **icon.png file ** in resource folder and run **ionic cordova run android. This generates the resource files for this platform and splash image and splash screen automatically changes and is added in config.xml file.

App Name is in sunbird.properties, change the app name to required name

This is installed with other npm packages.

Cordova-plugin-geniecanvas

On clicking on course material links, the course content is displayed in the inbuilt content player. The genie canvas renders the display of course materials in the inbuilt player.

Cordova-plugin-qr-scanner

This is a custom cordova plugin for the QR scanner.

This is installed with other npm packages.

Installing the Mobile Application

1.Create a workspace (i.e Folder Hierarchy ) and clone the Git repositories into this folder

2.Execute the instructions mentioned for each cloned repository

3.Open terminal and change the directory to “sunbird-mobile”

4.Add one device to the system

5.Run the command- $ ionic cordova run android


Edit | Report