Skip to content

Apache Cordova Plugin -- Check for hardware/software features

Notifications You must be signed in to change notification settings

mm108/FeatureDetector

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

FeatureDetector

This is an Android plugin for Apache Cordova / Phonegap. It allows you to check if certain hard- or software features are present on the current device.

The plugin is available at https://github.com/Airblader/FeatureDetector

Installation

  1. Add FeatureDetector.java to your project (package: org.apache.cordova.plugin)

  2. Add FeatureDetector.js into your project (somewhere in your assets/ folder)

  3. Add the following line to src/res/xml/config.xml

    <plugin name="FeatureDetector" value="org.apache.cordova.plugin.FeatureDetector" />

Usage

The plugin will be available at window.featureDetector and provides the method hasFeature(feature, callback). The features to check for can be found in window.featureDetector.FEATURE. For example, if you want to check for camera presence:

window.featureDetector.hasFeature(
    window.featureDetector.FEATURE.FEATURE_CAMERA,
    function (hasFeature) {
        if (hasFeature) {
            alert('Camera is present!');
        } else {
            alert('Sorry, no camera present!');
        }
    }
);

License

This plugin can be used freely without a license of any kind.

About

Apache Cordova Plugin -- Check for hardware/software features

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 80.8%
  • Java 19.2%