Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including cordova-plugin-audio-mode with all npm packages installed. Try it out:

cordova-plugin-audio-mode lists no main file and has no index.js, so it can't be directly required. If this is a mistake, please let us know. It may however contain internal files that you can require manually:

// require("cordova-plugin-audio-mode/[??]")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

cordova-plugin-audio-mode v1.1.2

Cordova Audio Mode Plugin

Cordova Audio Mode Plugin

Simple plugin that will change your audio mode. You can change your audio mode to vibrate, silent or normal.

Using

Add plugin to your cordova based project

$ cordova plugin add cordova-plugin-audio-mode

using this plugin is so simple just add the following code inside onDeviceReady

    //this is success callback function
    var success = function(message) {
        alert(message);  
    }
    
    //this is failure callback function
    var failure = function() {
        alert("something goes wrong");
    }

    audio_mode.change_audio_mode("vibrate", success, failure); //instead of 'vibrate' other values can 'normal' or 'silent'

Install Android platform

cordova platform add android

Run the code

cordova run 

this plugin is only working in android platform

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free