Para poder accedes a la cámara, audio, archivos, contactos y demás, este plugin es perfecto y complementa a la librería nwmaker-2.
Instalación:
cordova plugin add cordova-plugin-permission
Agregar esto a AndroidManifest.xml antes de </manifest>:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.MICROPHONE" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
Uso:
Nwmaker-2:
nw.getPermission(['android.permission.RECORD_AUDIO', 'android.permission.CAMERA', 'android.permission.MICROPHONE']);
Libre:
var Permission = window.plugins.Permission
// request grant for a permission
var permission = 'android.permission.RECORD_AUDIO'
Permission.request(permission, function(results) {
if (results[permission]) {
// permission is granted
}
}, alert)
// request grant for multiple permissions
var permissions = ['android.permission.RECORD_AUDIO', 'android.permission.READ_CONTACTS']
Permission.request(permissions, function(results) {
if (results['android.permission.RECORD_AUDIO']) {
// permission is granted
}
}, alert)
Fuente: https://www.npmjs.com/package/cordova-plugin-permission