Cordova DeviceInfo Plugin
This plugin contains various methods for retrieving miscellaneous device/app info.
Installation
Using the Cordova CLI
cordova plugins add org.cloudsky.cordovaplugins.deviceinfo
Usage
Get App ID
cloudSkydeviceInfo
Get App Version Name
cloudSkydeviceInfo
Get Device Jailbreak/Root Status
Performs a simplistic check on whether the device is rooted or jailbroken.
cloudSkydeviceInfo
Get Devcie Jailbreak/Root detection details
Get details about jailbreak / root detection, i.e. which tests considered the device to be jailbroken / rooted, which tests did not detect anything.
cloudSky.deviceInfo.getHackDetectionDetails(
function (details) {
// NOTE: Android and iOS have different sets of tests.
for(var testName in details) {
if(details[testName]) {
console.log(testName + " was positive.")
}
}
},
function (err) {
// Failure callback.
// `err` is an error message.
}
)
Troubleshooting
Android support library build error
If you get the following error when building on Android:
* What went wrong:
Execution failed for task ':processArmv7ReleaseManifest'.
> Manifest merger failed : Attribute meta-data#android.support.VERSION@value value=(26.0.0-alpha1) from [com.android.support:support-v4:26.0.0-alpha1] AndroidManifest.xml:27:9-38
is also present at [com.android.support:appcompat-v7:25.3.0] AndroidManifest.xml:27:9-31 value=(25.3.0).
Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:25:5-27:41 to override.
Try adding this to your cordova/platforms/android/build.gradle
file, replacing
the useVersion
with the ones you need:
dependencies {
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (requested.name == 'appcompat-v7') {
details.useVersion '23.+'
} else if (requested.name == 'support-v4') {
details.useVersion '26.+'
} else if (requested.name == 'support-compat') {
details.useVersion '25.0.1'
}
}
}
}
}