How can I get the call status / quiet status of the device using Cordoba?

I am developing a mobile application using Ionic and Cordova and would like to play sound based on the Ringer Mode status device.

Is there a way to find out the status of a device in ringer mode:

 vibration silent normal 

I found an example for Android here .

+6
source share
1 answer

The only plugin I could find is this one and it is available only for iOS. I could not check it myself, so I would recommend you take a look if you are interested in iOS.

Unfortunately, I could not find anything for Android. Therefore, I took it as a great opportunity to learn my own Cordova plugin. I have not tested it yet, and it only works for Android, but I think it can be used as a starting point for you and others.

Here you can find the repository here . Please feel free to develop or contribute to your existing repository. The plugin can be installed by running the following command: cordova plugin add https://github.com/RasimKanca/cordova-plugin-ringermode.git . And you can use it like this:

 plugins.ringerMode.getRingerMode(function(ringerMode) { console.log("The current ringerMode is:" + ringerMode); }); 

This method will return one of these three options: RINGER_MODE_VIBRATE , RINGER_MODE_NORMAL or RINGER_MODE_SILENT .

I learned the same for iOS, however, there seems to be no official way to determine the call status in iOS, as described here and here . If someone can shed light on how this can be achieved on iOS, feel free to comment, and I would be happy to add it to the plugin.

+2
source

All Articles