npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cordova-plugin-ardic

v1.0.27

Published

Ardic Android Plugin

Downloads

6

Readme

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

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 {DOMString} echoMsg echo message for sending android side.
 * @param {Function} successCallback returns echo message as success.
 * @param {Function} errorCallback error callback
 */
echo: function (echoMsg, successCallback, errorCallback)
Sample Usage:
CordovaAfexService.echo(echoMsg, function (echoValue) {
  alert("Callback Echo Message Success: " + echoValue) // should alert echo message.
}, function (error) {
  alert("Callback Message Failure  : " + error) // write down error message.
})

Device Unique Id

Returns device unique identifier.

/**
 * Get device unique id.
 *
 * @param {Function} successCallback returns device uniqueId.
 * @param {Function} errorCallback error callback.
 */

getDeviceId: function (successCallback, errorCallback)
Sample Usage:
CordovaAfexService.getDeviceId(function (deviceId) {
  alert("Callback message success device id: " + deviceId)
}, function (errorCallback) {
  alert("Callback message error  : " + errorCallback)
})

Reboot

Reboots device.

/**
 * Reboot device.
 *
 * @param {Function} successCallback returns success.
 * @param {Function} errorCallback error callback.
 */

rebootDevice: function (successCallback, errorCallback)
Sample Usage:
CordovaAfexService.rebootDevice(function (successCallback) {
  alert("Callback Message Success: " + successCallback)
}, function (errorCallback) {
  alert("Callback Message Failure  : " + errorCallback)
})

AFEX SDK Version

Returns AFEX version of Android OS.

/**
 * AFEX version on Android OS.
 *
 * @param {Function} successCallback afex version.
 * @param {Function} errorCallback error callback.
 */
getAfexSdkVersion: function (successCallback, errorCallback)
Sample Usage:
CordovaAfexService.getAfexSdkVersion(function (afexVersion) {
  alert("Afex Sdk Version: " + afexVersion)
}, function (errorCallback) {
  alert("Error Occured:\n " + errorCallback)
})

Set Time Zone

Sets device time zone.

/**
 * Set device timezone. Sample format : "Europe/Athens"
 *
 * @param {DOMString} timeZone timezone ("Europe/Athens")
 * @param {Function} successCallback timezone set success.
 * @param {Function} errorCallback error callback.
 */
setTimeZone: function (timeZone,successCallback, errorCallback) {
    cordova.exec(successCallback, errorCallback, "CordovaAfexService", "setTimeZone",[timeZone]);
}
Sample Usage:
CordovaAfexService.setTimeZone("Europe/Athens", function (newTimeZone) {
  alert("New TimeZone: " + newTimeZone)
}, function (errorCallback) {
  alert("Error Occured:\n " + errorCallback)
})

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 {number} epochTime epochTime (1531207969)
 * @param {Function} successCallback date set success.
 * @param {Function} errorCallback error callback.
 */
setDate: function (epochTime,successCallback, errorCallback) {
    cordova.exec(successCallback, errorCallback, "CordovaAfexService", "setDate",[epochTime]);
}
Sample Usage:

epochTime = 1531230783 // (Tuesday, July 10, 2018 4:53:03 PM GMT+03:00)
CordovaAfexService.setDate(epochTime, function (responseDate) {
  alert("Set Date Callback: " + responseDate)
}, function (errorCallback) {
  alert("Error Occured:\n " + errorCallback)
})

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 {number} epochTime epochTime (1531207969)
 * @param {Function} successCallback date set success.
 * @param {Function} errorCallback error callback.
 */
setTime: function (epochTime,successCallback, errorCallback) {
    cordova.exec(successCallback, errorCallback, "CordovaAfexService", "setTime",[epochTime]);
}
Sample Usage:

epochTime = 1531230783 // (Tuesday, July 10, 2018 4:53:03 PM GMT+03:00)
CordovaAfexService.setTime(epochTime, function (responseTime) {
  alert("Set Time Callback: " + responseTime)
}, function (errorCallback) {
  alert("Error Occured:\n " + errorCallback)
})

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 {boolean} auto  (true | false)
 * @param {Function} successCallback date set success.
 * @param {Function} errorCallback error callback.
 */
setAutoDateTime: function (auto,successCallback, errorCallback) {
    cordova.exec(successCallback, errorCallback, "CordovaAfexService", "setAutoDateTime",[auto]);
}
Sample Usage:
CordovaAfexService.setAutoDateTime(true, function (successCallback) {
  alert("Set Auto Date&Time Callback: " + successCallback)
}, function (errorCallback) {
  alert("Error Occured:\n " + errorCallback)
})

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 {number} streamType Stream type to be muted.
* @param {boolean} isMute Mute or unmute
* @param {Function} successCallback date set success.
* @param {Function} errorCallback error callback.
*/
setMuted: function (streamType, isMute, successCallback, errorCallback) {
   cordova.exec(successCallback, errorCallback, "CordovaAfexService", "setMuted",[streamType, isMute]);
}
Sample Usage:

If isMute is true, mutes selected stream. Otherwise unmutes the selected stream.

var STREAM_MUSIC = 3 // mutes stream. isMute=false
CordovaAfexService.setMuted(STREAM_MUSIC , false , function (successCallback) {
  alert("Callback: " + successCallback)
}, function (errorCallback) {
  alert("Error Occured:\n " + errorCallback)
})

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 {number} streamType Stream type of target's volume level.
 * @param {Function} successCallback volume level.
 * @param {Function} errorCallback error callback.
 */
getStreamVolumeLevel: function (streamType, successCallback, errorCallback) {
    cordova.exec(successCallback, errorCallback, "CordovaAfexService", "getStreamVolumeLevel",[streamType]);
}
Sample Usage:
var streamType = STREAM_MUSIC
CordovaAfexService.getStreamVolumeLevel(streamType, function (volume) {
  alert("Volume: " + volume)
}, function (errorCallback) {
  alert("Error Occured:\n " + errorCallback)
})

Install Application

Installs application from a valid file path.

/**
 * Silent install for given apk.
 * @param {DOMString} apkPath Full path off apk
 * @param {function} successCallback callback for installation success.
 * @param {function} errorCallback callback for failure.     
 */
installApplication: function (apkPath, successCallback, errorCallback) {
    cordova.exec(successCallback, errorCallback, "CordovaAfexService", "installApplication", [apkPath])
}
Sample Usage:
fullPath ="/storage/emulated/0/testApps/MySampleAndroidApp.apk"
CordovaAfexService.installApplication(fullPath, function (successCallback) {
  console.log(successCallback);
}, function (errorCallback){
  console.log(errorCallback)
})

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 {function} successCallback returns file path of saved image.
 * @param {function} errorCallback callback for failure.     
 */
takeScreenshot: function (successCallback, errorCallback) {
    cordova.exec(successCallback, errorCallback, "CordovaAfexService", "takeScreenshot")
},
Sample Usage:
CordovaAfexService.takeScreenshot(function (successCallback) {
  console.log(successCallback);
}, function (errorCallback){
  console.log(errorCallback)
})  

Clear Screenshot Directory

Removes the AfexScreenshots directory and its contents.

/**
 * Clear all files including directory "AfexScreenshots"
 * @param {function} successCallback success message.
 * @param {function} errorCallback callback for failure.
 *
 */
clearScreenshotDir: function(successCallback, errorCallback) {
    cordova.exec(successCallback, errorCallback, "CordovaAfexService", "clearScreenshotDir")
}
Sample Usage:
CordovaAfexService.clearScreenshotDir(function (successCallback) {
  console.log(successCallback);
}, function (errorCallback){
  console.log(errorCallback)
})

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 {DOMString} packageName package of target application
 * @param {DOMString} name shared preferences name
 * @param {DOMString} prefFile shared preferences key
 * @param {function} successCallback success message.
 * @param {function} errorCallback callback for failure.
 *
 */
readOtherAppsSharedPref: function(packageName, name, prefFile, successCallback, errorCallback) {
    cordova.exec(successCallback, errorCallback, "CordovaAfexService", "readOtherAppsSharedPref", [packageName, name, prefFile])
}
}
Sample Usage:
CordovaAfexService.readOtherAppsSharedPref("com.other.app.package.name", "shared_pref_name", "shared_pref_key", function (response) {
  alert("Callback  Message Success: " + response)
}, function (error) {
  alert("Callback Message Failure  : " + error)
})

Set Screen Lock

Lock/Unlock device screen

/**
 * lock/unlock device screen.
 * @param {boolean} lock locks device if true otherwise unlocks the device.
 * @param {function} successCallback success message.
 * @param {function} errorCallback callback for failure.
 *
 */
setScreenlock: function(lock, successCallback, errorCallback) {
    cordova.exec(successCallback, errorCallback, "CordovaAfexService", "setScreenlock", [lock])
}
Sample Usage:

Set true for lock, false for unlock the device.

CordovaAfexService.setScreenlock(true, function (successCallback) {
  console.log(successCallback);
}, function (errorCallback){
  console.log(errorCallback)
})

CordovaAfexService.setScreenlock(false, function (successCallback) {
  console.log(successCallback);
}, function (errorCallback){
  console.log(errorCallback)
})

Back To Top