A utility plugin to enable various native capabilities in Sunbird-mobile-app.
cordova plugin add https://github.com/Sunbird-Ed/sb-cordova-plugin-utility.git#<branch_name>
To install it locally
Clone the repo then execute the following command
cordova plugin add <location_of_plugin>/sb-cordova-plugin-utility
- sbutility
- .getBuildConfigValue(package, property, successCallback, errorCallback)
- .getBuildConfigValues(package, successCallback, errorCallback)
- .rm(directoryPath, directoryToBeSkipped, successCallback, errorCallback)
- .openPlayStore(appId, successCallback, errorCallback)
- .getDeviceAPILevel(successCallback, errorCallback)
- .checkAppAvailability(packageName, successCallback, errorCallback)
- .getDownloadDirectoryPath(successCallback, errorCallback)
- .exportApk(destination, successCallback, errorCallback)
- .getDeviceSpec(successCallback, errorCallback)
- .createDirectories(parentDirectory, identifiers, successCallback, errorCallback)
- .writeFile(fileMapList, successCallback, errorCallback)
- .getMetaData(fileMapList, successCallback, errorCallback)
- .getAvailableInternalMemorySize(successCallback, errorCallback)
- .getUtmInfo(successCallback, errorCallback)
- .clearUtmInfo(successCallback, errorCallback)
- .getStorageVolumes(successCallback, errorCallback)
- .copyDirectory(sourceDirectory, destinationDirectory, successCallback, errorCallback)
- .renameDirectory(sourceDirectory, toDirectoryName,successCallback, errorCallback)
- .canWrite(directory, successCallback, errorCallback)
- .writeFile(successCallback, errorCallback)
- .getFreeUsableSpace(directory, successCallback, errorCallback)
- .readFromAssets(filePath, successCallback, errorCallback)
- .copyFile(sourceDirectory, destinationDirectory, fileName, successCallback, errorCallback)
- .getApkSize(successCallback, errorCallback)
- .verifyCaptcha(apiKey, successCallback, errorCallback)
- .startActivityForResult(params, successCallback, errorCallback)
- .getAppAvailabilityStatus(appList, successCallback, errorCallback)
- .openFileManager(successCallback, errorCallback)
Retrieves the property value from BuildConfig.class in android
package
represents packageName of BuildConfig.class.property
represents property name.
Retrieves all the properties available in BuildConfig.class
package
represents packageName of BuildConfig.class.
Deletes the file located in given directory path.
directoryPath
represents path of the directory.directoryToBeSkipped
represents path of the directory which is to be skipped.
appId
represents appId of the application to be opened in playstore.
Returns the device API version
Returns true if the app is avaialable in the device.
packageName
represents packageName of the app.
Returns download directory path.
Extracts the apk to given location.
destination
represents destination directory.
Extracts the apk to given location.
destination
represents destination directory.
Createss directories inside given root directory.
parentDirectory
represents root directory.identifiers
represents folder names.
Writes file in the given directory path.
fileMapList
represents a map containing file name as key and destination as value.
Returns metadata of the files given in the map.
fileMapList
represents a map containing file name as key and destination as value.
Returns internal memory size.
If a playstore link is clicked and that link has some UTM info then those UTM info is stored in preference and this method returns the UTM info.
Clears the UTM info stored while playstore link click.
Returns number of storage volumes available in the device.
Copies directory from source directory to destination.
sourceDirectory
represents source directory path.destinationDirectory
represents destination directory path.
Rename the directory name.
sourceDirectory
represents source directory path.toDirectoryName
represents new directory name.
Returns if directory is writable or not.
directory
represents directory path.destinationDirectory
represents destination directory path.
Returns free space available in given directory
directory
represents source directory path.
Clears the UTM info stored while playstore link click.
directory
represents source directory path.
Copies file from source directory to destination directory.
sourceDirectory
represents source directory path.destinationDirectory
represents destination directory path.fileName
represents name of the file.
Returns size of the APK.
verifies the captcha.
apiKey
represents API key of Google CAPTCHA.
Starts a new activity while wating for result.
params
represents parametrs taht will be sent to another activity.
Returns app availability status on the device.
appList
represents list of app package id.
Opens File Manager