cordova-plugin-ardic
Ardic Cordova Android Plugin
This plugin works well on Android devices integrated with AFEX only.
Installation
In your application directory, write:
cordova plugin add cordova-plugin-ardic
AFEX API List
- Echo
- Device Unique Id
- Reboot
- AFEX Sdk Version
- Set Time Zone
- Set Date
- Set Time
- Set Auto Date Time
- Set Muted
- Get Stream Volume Level
- Install Application
- Take Screenshot
- Clear Screenshot Directory
- Read Other Application Shared Preferences
- Set Screen Lock
Usage
File API's
This plugin uses the Cordova File Plugin as is. You can check documentation for file API's from here. You don't have to install file plugin separately.
AFEX API's
CordovaAfexService is root instance for API's.
Echo
Echo is a simple test API for plugin installation. It echoes back the received message.
/** * Echo back to sending message. It's useful for plugin installation test. * * @param * @param * @param */
Sample Usage:
CordovaAfexService
Device Unique Id
Returns device unique identifier.
/** * Get device unique id. * * @param * @param */
Sample Usage:
CordovaAfexService
Reboot
Reboots device.
/** * Reboot device. * * @param * @param */
Sample Usage:
CordovaAfexService
AFEX SDK Version
Returns AFEX version of Android OS.
/** * AFEX version on Android OS. * * @param * @param */
Sample Usage:
CordovaAfexService
Set Time Zone
Sets device time zone.
/** * Set device timezone. Sample format : "Europe/Athens" * * @param * @param * @param */ { cordova;}
Sample Usage:
CordovaAfexService
Set Date
Sets device date. Only sets year, month and day.
/** * Set device date. Sample format : 1531207969 -> epoch time * Note: Set only year, month and day * * @param * @param * @param */ { cordova;}
Sample Usage:
epochTime = 1531230783 // (Tuesday, July 10, 2018 4:53:03 PM GMT+03:00)CordovaAfexService
Set Time
Sets device time. Only sets hours and minutes.
/** * Set device time. Sample format : 1531207969 -> epoch time * Note: Set only hour and minute. * * @param * @param * @param */ { cordova;}
Sample Usage:
epochTime = 1531230783 // (Tuesday, July 10, 2018 4:53:03 PM GMT+03:00)CordovaAfexService
Set Auto Date Time
Sets device date and time automatically.
/** * Set device date & time automatic. * Device will set time&date through it local settings. * * @param * @param * @param */ { cordova;}
Sample Usage:
CordovaAfexService
Set Muted
Mute/unmute device sound.
Stream Types:
- STREAM_VOICE_CALL = 0
- STREAM_SYSTEM = 1
- STREAM_RING = 2
- STREAM_MUSIC = 3
- STREAM_ALARM = 4
- STREAM_NOTIFICATION = 5
- STREAM_DTMF = 8
- STREAM_ACCESSIBILITY = 10
For more info about Android audio manager you can check here.
/*** Mute or unmute selected stream sound.* Stream type can be:* STREAM_VOICE_CALL,* STREAM_SYSTEM,* STREAM_RING,* STREAM_MUSIC,* STREAM_ALARM,* STREAM_ACCESSIBILITY.* @param* @param* @param* @param*/ { cordova;}
Sample Usage:
If isMute is true, mutes selected stream. Otherwise unmutes the selected stream.
var STREAM_MUSIC = 3 // mutes stream. isMute=falseCordovaAfexService
Get Stream Volume Level
Returns volume level of selected stream.
/** * Retuns volume level of selected stream * Stream type can be: * STREAM_VOICE_CALL, * STREAM_SYSTEM, * STREAM_RING, * STREAM_MUSIC, * STREAM_ALARM, * STREAM_ACCESSIBILITY. * Callback -> Returns volume level. * @param * @param * @param */ { cordova;}
Sample Usage:
var streamType = STREAM_MUSICCordovaAfexService
Install Application
Installs application from a valid file path.
/** * Silent install for given apk. * @param * @param * @param */ { cordova}
Sample Usage:
fullPath ="/storage/emulated/0/testApps/MySampleAndroidApp.apk"CordovaAfexService
Take Screenshot
Takes screenshot from device and saves it under application's internal directory, __ getFilesDir() + "AfexScreenshots"
- Sample directory: /data/user/0/com.my.application.package.name/files/AfexScreenshots
- Sample filename: 2018-07-12-12:37:18.jpeg
- Sample success callback message is full path of saved image: /data/user/0/com.my.application.package.name/files/2018-07-12-12:37:18.jpeg
/** * Takes screenshot from device. * @param * @param */ { cordova}
Sample Usage:
CordovaAfexService
Clear Screenshot Directory
Removes the AfexScreenshots directory and its contents.
/** * Clear all files including directory "AfexScreenshots" * @param * @param * */ { cordova}
Sample Usage:
CordovaAfexService
Read Other Application Shared Preferences
Read shared preferences from given package. Application's process and shared user id must be same.
/** * Read another package's shared pref * @param * @param * @param * @param * @param * */ { cordova}}
Sample Usage:
CordovaAfexService
Set Screen Lock
Lock/Unlock device screen
/** * lock/unlock device screen. * @param * @param * @param * */ { cordova}
Sample Usage:
Set true for lock, false for unlock the device.
CordovaAfexService CordovaAfexService