
Capacitor Has a Free API — Here's How to Build Native Mobile Apps with Web Tech
Capacitor by Ionic lets you build native iOS and Android apps using web technologies. It provides a bridge between your web app and native device APIs — camera, geolocation, filesystem, and more. Getting Started npm install @capacitor/core @capacitor/cli npx cap init my-app com.example.myapp npx cap add ios npx cap add android Camera Plugin import { Camera , CameraResultType , CameraSource } from " @capacitor/camera " ; const photo = await Camera . getPhoto ({ quality : 90 , allowEditing : true , resultType : CameraResultType . Uri , source : CameraSource . Camera }); console . log ( photo . webPath ); // Display in <img> tag Geolocation import { Geolocation } from " @capacitor/geolocation " ; const position = await Geolocation . getCurrentPosition (); console . log ( `Lat: ${ position . coords . latitude } ` ); console . log ( `Lng: ${ position . coords . longitude } ` ); // Watch position changes const watchId = await Geolocation . watchPosition ({}, ( position ) => { console . log (
Continue reading on Dev.to JavaScript
Opens in a new tab

