Vibration and Camera

cordova-plugin-vibration and cordova-plugin-camera

On Android, cordova-plugin-vibration (3.1.1, July 2019) contains no code at all: its plugin.xml only adds the VIBRATE permission, and navigator.vibrate() is the WebView's own Vibration API. That API obeys the web's rule that a page may vibrate only after a user gesture, which the first line below shows.

cordova-plugin-camera (8.0.0) opens the system camera app through an Android intent, so it needs no camera permission, and returns a file URL or a Base64 string:

Vibrating without a tap, then taking a photo with the camera pluginJavaScript
const vibrated = navigator.vibrate([200, 100, 200]);
const photo = await new Promise((resolve, reject) =>
  navigator.camera.getPicture(resolve, reject, {
    quality: 60, targetWidth: 800, correctOrientation: true,
    destinationType: Camera.DestinationType.FILE_URI,
  }));
({ vibrated, photo });
Output
{
  vibrated: false,
  photo: 'file:///data/user/0/com.example.booknest/cache/.../1790294427701.jpg'
}

Run from the console, vibrate() returned false; the same call from a button's click handler returned true. After a tap on the shutter and the check mark, the photo arrived as a JPEG in the app's cache, ready to read or upload with the File plugin (File and Geolocation). Prefer FILE_URI to DATA_URL, which sends megabytes of Base64 across the bridge (Architectural Limits).