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
Enter fullscreen mode
Exit fullscreen mode
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
Enter fullscreen mode
Exit fullscreen mode
Geolocation
import { Geolocation } from " @capacitor/geolocation " ;
const position = await Geolocation . getCurrentPosition (); console . log ( `Lat: ${ position . coords . latitude } ` ); console . log ( `Lng: ${ position . coords .…