Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@capacitor/preferences

ionic-team338.8kMIT7.0.0TypeScript support: included

The Preferences API provides a simple key/value persistent store for lightweight data.

capacitor, plugin, native

readme

Capacitor Plugins

This repository contains the official Capacitor plugins maintained by the Capacitor team. You can find more plugins in the Capacitor Community.

:rotating_light: These plugins are for Capacitor 6 :rotating_light:

Capacitor 2 core plugins are bundled with Capacitor itself.

For Capacitor 3, use the 1.x version of the plugins. For Capacitor 4, use the 4.x version of the plugins. For Capacitor 5, use the 5.x version of the plugins.

Plugins

Package Source Version
@capacitor/action-sheet ./action-sheet npm badge
@capacitor/app-launcher ./app-launcher npm badge
@capacitor/app ./app npm badge
@capacitor/browser ./browser npm badge
@capacitor/camera ./camera npm badge
@capacitor/clipboard ./clipboard npm badge
@capacitor/device ./device npm badge
@capacitor/dialog ./dialog npm badge
@capacitor/filesystem ./filesystem npm badge
@capacitor/geolocation ./geolocation npm badge
@capacitor/haptics ./haptics npm badge
@capacitor/keyboard ./keyboard npm badge
@capacitor/local-notifications ./local-notifications npm badge
@capacitor/motion ./motion npm badge
@capacitor/network ./network npm badge
@capacitor/preferences ./preferences npm badge
@capacitor/push-notifications ./push-notifications npm badge
@capacitor/screen-orientation ./screen-orientation npm badge
@capacitor/screen-reader ./screen-reader npm badge
@capacitor/share ./share npm badge
@capacitor/splash-screen ./splash-screen npm badge
@capacitor/status-bar ./status-bar npm badge
@capacitor/text-zoom ./text-zoom npm badge
@capacitor/toast ./toast npm badge

Independent Plugins

These are official Capacitor plugins that are not contained in this repository.

GitHub Package Version
Background Runner @capacitor/background-runner npm badge
Barcode Scanner @capacitor/barcode-scanner npm badge
Google Maps @capacitor/google-maps npm badge

Capacitor Labs

These are experimental plugins. Use at your own risk.

GitHub Package Version
Watch @capacitor/watch npm badge

Contributing

See CONTRIBUTING.md.

changelog

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

4.0.1 (2022-07-28)

Note: Version bump only for package capacitor-plugins

4.0.0 (2022-07-27)

Bug Fixes

  • share: Prevent crash on no shareable files (#1088) (dc67e7b)
  • status-bar: not working on older devices (#1078) (4e34977)

Features

  • keyboard: add getResizeMode function (#1082) (594d854)
  • splash-screen: Use Android 12 Splash Screen API (#1011) (79185ad)

4.0.0-beta.2 (2022-07-08)

Features

  • browser: Allow to configure popover size (#1056) (90eb1e5)
  • google-maps: provides variables for configuring dependencies (#1063) (5c077f1)
  • local-notifications: Add delivered notification handling (#1060) (0a89dc9)

4.0.0-beta.0 (2022-06-27)

Bug Fixes

  • app: Don't unset App Listeners on removeAllListeners (#716) (17f2ee8)
  • app: get correct build value (#858) (4d3b125)
  • app: use alternative to deprecated versionCode (#491) (6ebabf7)
  • browser: browserFinished does not fire when closing popovers (#483) (fb8dbb8)
  • camera: Append exif to android images (#480) (cad8a30)
  • camera: avoid error if image has no orientation (#554) (dc8a55a)
  • camera: cleanup camera images if not needed (#563) (a2e4f43)
  • camera: Don't save gallery images on iOS 14+ (#696) (7b2cc88)
  • camera: Make allowEdit work on all devices (#552) (5224177)
  • camera: Make web use source options (#487) (7870e6b)
  • camera: process picked image only once (#782) (897dcaf)
  • camera: Properly reset orientation exif if corrected (#545) (ad8c325)
  • camera: Remove capture attribute from multiple photo picker (#687) (e551ef7)
  • camera: Reset exif orientation if corrected (#510) (a65c05e)
  • camera: Resize not respecting aspect ratio on iOS (#568) (ea2b801)
  • camera: return original image if editing is cancelled (#566) (4786841)
  • camera: Return proper exif when picking multiple images (#712) (8451237)
  • camera: return single picture on pickImages (#783) (9d65db1)
  • camera: Return the full webPath (#502) (e849732)
  • camera: Return the image on dismiss completion (#849) (f083841)
  • camera: saveToGallery for edited images (#602) (b5ac27d)
  • camera: set camera direction for web (#665) (4afedb9)
  • camera: set settings again on callbacks (#595) (908bd68)
  • camera: Use Locale.ROOT on toUpperCase (#812) (6d689ac)
  • device: handle case of no localStorage for getId (#1059) (5f77a7d)
  • device: isVirtual is false on M1 simulators (#726) (5377586)
  • device: return short language code in web (#893) (07f0887)
  • filesystem: allow copy if from is not parent of to (#546) (a70414e)
  • filesystem: Prevent android crash on invalid base64 write (#937) (1af0bfe)
  • filesystem: Throw errors instead of strings (#746) (af4b875)
  • filesystem: web appendFile with base64 data (#928) (80253cf)
  • geolocation: reject checkPermissions / requestPermissions if location services are disabled (#1053) (774ec6e)
  • geolocation: return cached location if newer than maximumAge (#639) (7b08eea)
  • geolocation: stop location requests on pause (#1018) (eb24f25)
  • google-maps: correctly typed event listeners (656f916)
  • google-maps: Fixing map touch events on Android (7cb89fb)
  • ios: Check if UIApplicationDelegate responds to window selector (#1032) (5be1466)
  • keyboard: Prevent null pointer if native listener not set (#789) (8b6f119)
  • local-notifications: Add FLAG_MUTABLE to pending intents for SDK 31 support (#914) (9ad0ce6)
  • local-notifications: Handle case of not allowed exact notifications (#954) (5016996)
  • local-notifications: requestPermissions and checkPermissions return if enabled (#494) (555bb1f)
  • local-notifications: Throw errors if missing mandatory channel fields (#577) (6bf3a4f)
  • push-notifications: Throw errors if missing mandatory channel fields (#576) (50f4e70)
  • push-notifications: use id and tag for canceling active notification (#1041) (fa710a6)
  • share: avoid crash when targeting SDK 31 (#913) (275da5f)
  • Make removeAllListeners return a promise (#895) (e5c49d6)
  • local-notifications: return schedule on as object (#603) (ca34b01)
  • local-notifications: use proper rollup config (#528) (cd17daa)
  • network: Don't add window event listeners if there is no window (#678) (0c65780)
  • share: correct whatsapp file sharing (#816) (18b10c4)
  • share: Prevent share if sharing in progress (#489) (3479783)
  • splash-screen: avoid conditional downcast warning (#776) (87ed912)
  • splash-screen: pick first window when there is no key window (#730) (0e335ad)
  • splash-screen: Use configured storyboard instead of hardcoded value (#548) (67dd67f)
  • splash-screen: Use Locale.ROOT on toLowerCase (#813) (ecc55e1)
  • status-bar: Use Locale.ROOT on toUpperCase (#814) (bf804ce)
  • inline source code in esm map files (#760) (a960489)
  • action-sheet: add back deprecated ActionSheetOptionStyle type (e026425)
  • action-sheet: change package name to 'actionsheet' (#57) (5cf608b)
  • android: fire localNotificationReceived event on Android (#217) (d97682d)
  • android: permissions use "publicStorage" as alias (#202) (2dfc7a3)
  • android: support writing files without scheme (#241) (4285cb1)
  • app: remove iOS deprecate warnings (#121) (d009826)
  • app: Update getLaunchUrl return type as can be undefined (#299) (cdc446b)
  • browser: don't expose load method (#128) (945e59b)
  • browser: prevent crash on popover presentation (#369) (a9d4380)
  • camera: Append change listener only once (#486) (5b7021e)
  • camera: correct photo resizing on iOS (#460) (bc56e03)
  • camera: decode content uri when retrieving image from gallery (#277) (a6cd1ad)
  • camera: fix camera source on Android (#164) (e67f7c6)
  • camera: Make input file hidden (#484) (cdc1835)
  • camera: query IMAGE_CAPTURE intent required by SDK 30 (#160) (6484991)
  • camera: Remove unused saveCall (#401) (95920da)
  • camera: return file URL for path, not system path (#170) (8a9e5c3)
  • clipboard: prevent NotAllowedError on first method invocation (#342) (ab8eecb)
  • dialogs: put cancel button of confirm/prompt on the left (#346) (1ac23db)
  • filesystem: Append doesn't resolve on iOS (#305) (98e91cd)
  • filesystem: Convert stat ctime/mtime timestamp to milliseconds (#321) (d978986)
  • filesystem: copy doesn't resolve on Android (#233) (17cbf3b)
  • filesystem: is not requesting permission on public directories (#246) (aa897ab)
  • filesystem: Make ctime optional (#373) (e3c6212)
  • filesystem: rmdir doesn't resolve on iOS (#239) (7ca538b)
  • filesystem: Use PermissionState from @capacitor/core (#148) (5ce3c5d)
  • geolocation: Make getCurrentPosition return only once (#470) (c5f1ceb)
  • geolocation: Replace deprecated call.save with new keepAlive API (#375) (e4e7cf4)
  • geolocation: Use the new APIs for handling/saving calls (#374) (ebd5b52)
  • ios: Coerce 'extra' field to add missing notification data on events (#231) (46ce6b2)
  • ios: do not show notifications when in foreground (#209) (1994997)
  • keyboard: remove deprecated warnings (#122) (a6e207c)
  • keyboard: Use new Config name for scroll (#335) (bec3d22)
  • local-notification: Throw unavailable if Notification API not supported (#285) (a90a88b)
  • local-notifications: Adding check for new Notification support (#295) (a806f22)
  • local-notifications: Checking for null schedule in notification JSObject (#258) (73cb416)
  • local-notifications: don't store notifications if not scheduled (#310) (c1445fd)
  • local-notifications: extra not being returned on notification events (#340) (5b03a7f)
  • local-notifications: Make getPending not return already fired notifications (#256) (fb96f8a)
  • local-notifications: Opt out of Capacitor date serialization (#264) (6e447d5)
  • push-notifications: bump iOS deployment target to 12.0 (#183) (d5b6503)
  • push-notifications: make removeAllListeners available (#454) (d92c925)
  • push-notifications: proper return of push notification object properties (#349) (733fc06)
  • share: Avoid SecurityError on Android 10 file share (#63) (b6a8191)
  • share: set type to / if no mine type can be found (#324) (40d4baa)
  • splash-screen: launchAutoHide not working on iOS (#319) (2a83fcb)
  • storage: configure doesn't resolve on Android and iOS (#266) (4f51b24)
  • text-zoom: Lazy load iOS implementation (#735) (5039a74)
  • add es2017 lib to tsconfig (#180) (2c3776c)
  • better ignore rules for npm distribution (#32) (b8d55b9)
  • correct addListeners links (#655) (f9871e7)
  • Correct missing source_files path (#590) (24e0fc2)
  • normalize use of integers for notification IDs (#195) (b56e111)
  • web: fix scheduled notifications not being sent (#220) (c8e92d6)
  • export all TS definitions (6cd2996)
  • Migrate plugins from Color.parseColor() to WebColor.parseColor() (#140) (26625cf)
  • remove postpublish scripts (#656) (ed6ac49)
  • support deprecated types from Capacitor 2 (#139) (2d7127a)
  • support deprecated types from Capacitor 2 (#210) (b559e24)
  • Use the event names from Capacitor 2 (#215) (008fe9e)
  • push-notifications: remove unused Firebase/Messaging dependency (#186) (0f4ca7c)
  • status-bar: remove deprecate warnings (#120) (5dcfb25)
  • storage: Remove warning on getString usage (#85) (db9c9c0)
  • use correct package in manifest files (#22) (ab62987)

Features

  • android: implements Activity Result API changes for permissions and activity results (#222) (f671b9f)
  • google-maps: Google Maps Bounds (14a045d)
  • set targetSDK default value to 32 (#970) (fa70d96)
  • action-sheet: Make title optional (#805) (2018f78)
  • android: support for minimizeApp (#743) (3ec2008)
  • app: Add canGoBack to backButton event (#265) (6d7861e)
  • app: return promise in exitApp (#777) (38e1efc)
  • camera: Add new method for multiple image picking from gallery (#671) (a49c590)
  • camera: Return if image was saved to gallery (#599) (594af3b)
  • camera: Support for 1 Gallery app (#791) (77e8c97)
  • camera: Support for Samsung Gallery app on pickImages (#706) (fd059fc)
  • camera: use a distinguishable permission denied string for camera and photos (#379) (c71657f)
  • camera: Use same error messages for permission deny (#404) (fffcd47)
  • device: Add getLanguageTag function (#939) (d268e4a)
  • device: Add realDiskTotal and realDiskFree properties (#694) (3f67643)
  • device: model now reflects exact model on iOS (#929) (302d813)
  • dialog: Make title optional (#940) (497f627)
  • filesystem: Make readDir return files information (#949) (0a9f43d)
  • filesystem: Return path of copied file (#931) (310f583)
  • geolocation: Throw error if location is disabled (#589) (14724c5)
  • keyboard: Use KeyboardStyle for style config option (#969) (42a01b4)
  • push-notifications: Allow to show while in foreground (#919) (a90b5fd)
  • Upgrade gradle to 7.4 (#826) (5db0906)
  • Use java 11 (#910) (5acb2a2)
  • filesystem: support Library directory (#666) (ce7ee95)
  • geolocation: Add new alias for coarse location (#684) (7563040)
  • geolocation: Error if Google Play Services are not available (#709) (fc79c43)
  • haptics: Implement duration for vibration (#618) (78e6b68)
  • local-notifications: Add weekday scheduling support for Android and iOS (#756) (430b485)
  • push-notifications: Add new type for registrationError (#808) (e5e78bb)
  • set targetSDK default value to 31 (#824) (3ee10de)
  • app-launcher: make openUrl open urls on web (#152) (2eba7b4)
  • device: add browser/webview version to getInfo() (#109) (48c49c1)
  • device: Add deviceInfo.name implementation for Android (#88) (bdc3b38)
  • device: Add getId function (#370) (96664c6)
  • filesystem: Allow the use of absolute urls on iOS and web (#250) (03ad97c)
  • keyboard: Add default style option for setStyle (#334) (9dbb809)
  • keyboard: add types for config files (#115) (09bba16)
  • keyboard: Make resize work in apps that use scenes (#729) (6dde082)
  • Keyboard: Add resizeOnFullScreen plugin configuration (#627) (8e87836)
  • local-notifications: add more info to pending notifications (#211) (7c50487)
  • local-notifications: Adding summary text to grouped notifications (#296) (f625bd2)
  • local-notifications: Fire local notifications while app is idle (#237) (43380ef)
  • local-notifications: Support for Big Text and Inbox Notification Style (#280) (dc96ef9)
  • local-notifications: Support setting seconds in Schedule "on" (#253) (4ec8d06)
  • share: Add canShare method to check availability (#748) (3883d82)
  • splash-screen: add useDialog and layoutName options for Android (#519) (f48733f)
  • splash-screen: Make splash work in apps that use scenes (#631) (cf0d214)
  • splash-screen: Use Launch Storyboard for splash (#516) (0292dab)
  • storage: Add removeOld function (#585) (698350e)
  • storage: make StorageConfiguration init public (#532) (4271b5d)
  • web: implement ActionPerformed and Received events (#219) (e062901)
  • Action Sheet plugin (#42) (8435243)
  • add commonjs output format (#179) (8e9e098)
  • App plugin (#71) (94e4219)
  • AppLauncher plugin (#74) (934bdb1)
  • Browser plugin (#16) (6ad5597)
  • Camera plugin (#33) (4864928)
  • Clipboard plugin (fd89544)
  • Device plugin (#47) (9870e30)
  • Dialog plugin (#44) (d7f0dd5)
  • Filesystem plugin (#19) (3b86a4a)
  • Geolocation plugin (#13) (911ae71)
  • Haptics plugin (#5) (95322d3)
  • Keyboard plugin (#59) (3a65a9a)
  • Local Notifications plugin (#94) (e59ba9c)
  • Motion plugin (#17) (21ace16)
  • Network plugin (#8) (08d9891)
  • Push Notifications plugin (#126) (0bcd833)
  • Screen Reader plugin (#1) (d0ab633)
  • Share plugin (#39) (9076c8e)
  • SplashScreen plugin (#149) (c5f44be)
  • Status Bar plugin (#58) (9a04a5d)
  • Storage plugin (#15) (9dfdd85)
  • Text Zoom plugin (#9) (cc18d0f)
  • Toast plugin (#52) (b52dc47)