Replacing Cordova Plugins

Replacing Cordova Plugins with Capacitor Equivalents

Most core Cordova 129 plugins have a direct Capacitor 243,123 replacement (versions are npm 2,036 latest on 24 September 2026):

Cordova plugins and their Capacitor replacements
Cordova plugin Capacitor replacement Main change
cordova-plugin-device @capacitor/device 8.0.3 Device.getInfo() promise, no global
cordova-plugin-dialogs @capacitor/dialog 8.0.1 Dialog.alert(), confirm(), prompt()
cordova-plugin-geolocation @capacitor/geolocation 8.2.2 Native location, explicit permissions
cordova-plugin-camera @capacitor/camera 8.2.4 takePhoto() (Camera)
cordova-plugin-file @capacitor/filesystem 8.1.3 Paths plus a Directory
cordova-plugin-inappbrowser @capacitor/browser 8.0.4 Custom Tab, no script injection
cordova-plugin-splashscreen, -statusbar @capacitor/splash-screen, status-bar Configured in the config file

The notes app swapped three. Having no bundler, it reads the proxies from the global Capacitor.Plugins; with Vite 25,978 you import them from their packages, as BookNest does:

Swapping the three pluginsShell
npm install @capacitor/device @capacitor/dialog @capacitor/geolocation
npm uninstall cordova-plugin-device cordova-plugin-dialogs cordova-plugin-geolocation
www/js/app.js after the swapJavaScript
const { Device, Dialog, Geolocation } = Capacitor.Plugins;
const out = (text) => {
  document.querySelector('#out').textContent = text;
  console.log('NOTES ' + text);
};
(async () => {
  const note = document.querySelector('#note');
  note.value = localStorage.getItem('note') || '';
  const info = await Device.getInfo();
  out(`${location.origin} on ${info.platform} ${info.osVersion}, ${info.model}`);
  document.querySelector('#save').addEventListener('click', async () => {
    localStorage.setItem('note', note.value);
    await Dialog.alert({ title: 'BookNest', message: 'Note saved.', buttonTitle: 'OK' });
  });
  document.querySelector('#where').addEventListener('click', async () => {
    try {
      const pos = await Geolocation.getCurrentPosition({ enableHighAccuracy: true });
      out(`You are at ${pos.coords.latitude}, ${pos.coords.longitude}`);
    } catch (err) {
      out(`No position: ${err.message}`);
    }
  });
})();

There is no deviceready to wait for, and every call returns a promise instead of taking two callbacks. Watch for what the old plugin did silently: cordova-plugin-geolocation added the location permissions, while @capacitor/geolocation leaves them to your manifest (Geolocation). On this emulator the Cordova version's WebView geolocation timed out, while the Capacitor plugin returned the emulator's position.