$mediaDevices
Updated on Aug 29, 2025 8 minutes to readThe Media Devices Plugin provides methods to interact with device hardware and system features, such as scanning barcodes, accessing geolocation, handling files, sharing content, managing permissions, and controlling the status bar.
Properties
Property | Description |
---|---|
BARCODE_AZTEC | Barcode type: Aztec. |
BARCODE_CODABAR | Barcode type: Codabar. |
BARCODE_CODE128 | Barcode type: Code128. |
BARCODE_CODE39 | Barcode type: Code39. |
BARCODE_CODE39MOD43 | Barcode type: Code39Mod43. |
BARCODE_CODE93 | Barcode type: Code93. |
BARCODE_DATAMATRIX | Barcode type: DataMatrix. |
BARCODE_EAN13 | Barcode type: EAN13. |
BARCODE_INTERLEAVED2OF5 | Barcode type: Interleaved2of5. |
BARCODE_ITF14 | Barcode type: ITF14. |
BARCODE_MAXICODE | Barcode type: MaxiCode. |
BARCODE_PDF417 | Barcode type: PDF417. |
BARCODE_QR | Barcode type: QR. |
BARCODE_RSS14 | Barcode type: RSS14. |
BARCODE_RSSEXPLANDED | Barcode type: RSS Expanded. |
BARCODE_UPC_A | Barcode type: UPC-A. |
BARCODE_UPC_E | Barcode type: UPC-E. |
BARCODE_UPC_EAN | Barcode type: UPC-EAN. |
LOCATION_ACCURACY_BALANCED | Accurate to within one hundred meters. |
LOCATION_ACCURACY_BEST_FOR_NAVIGATION | The highest possible accuracy that uses additional sensor data to facilitate navigation apps. |
LOCATION_ACCURACY_HIGH | Accurate to within ten meters of the desired target. |
LOCATION_ACCURACY_HIGHEST | The best level of accuracy available. |
LOCATION_ACCURACY_LOW | Accurate to the nearest kilometer. |
LOCATION_ACCURACY_LOWEST | Accurate to the nearest three kilometers. |
PERMISSION_CAMERA | Permission constant for camera access. |
PERMISSION_FOREGROUND_LOCATION | Permission constant for foreground location. |
PERMISSION_GALLERY | Permission constant for gallery access. |
PERMISSION_PUSH_NOTIFICATIONS | Permission constant for push notifications. |
Methods
Method | Description |
---|---|
getCurrentPosition | Retrieves the device’s current geolocation. |
getDeviceInfo | Returns information about the device, platform, and granted permissions. |
hideStatusBar | Hides the mobile app status bar. |
hasPermission | Returns the current status of a permission. |
isApple | Returns whether the device is an Apple device (iOS or Mac). |
isAndroid | Returns whether the device is running Android. |
isIOS | Returns whether the device is running iOS. |
isMac | Returns whether the device is a Mac. |
isMobileDevice | Returns whether the device is a mobile device (iOS or Android). |
openExternalLink | Opens a URL in a browser or an installed app supporting this type of link. |
openSettings | Open the operating system settings app and displays the app’s custom settings, if it has any. |
requestAppRate | In ideal circumstances this will open a native modal and allow the user to select a star rating that will then be applied to the App Store, without leaving the app. |
requestPermission | Requests a specific system permission. If access is not granted, this will open a native modal to request permission. |
scanBarcode | Scans a barcode of specified types and returns the scanned value. |
scanQrCode | Scans a QR code and returns its value. |
share | Shares a file with other apps or services. |
showStatusBar | Shows the mobile app status bar. |
Methods Details
getCurrentPosition()
• Type
(accuracy: number, maxAge?: number) => Promise<GeolocationPosition>
• Details
Expects one of the LOCATION_ACCURACY levels (defined in plugin properties) and an optional maxAge
in milliseconds.
Returns a Promise that resolves with the current GeolocationPosition object.
getDeviceInfo()
• Type
() => Promise<DeviceInfo>
• Details
Returns a Promise that resolves with a DeviceInfo object.
hasPermission()
• Type
(permission: string) => Promise<boolean>
• Details
Expects one of the PERMISSION types (defined in plugin properties), for example: PERMISSION_CAMERA
, PERMISSION_FOREGROUND_LOCATION
.
Returns a Promise resolving with true if the permission is granted, otherwise false.
hideStatusBar()
• Type
() => void
• Details
Hides the system status bar on mobile devices.
isAndroid()
• Type
() => Promise<boolean>
• Details
Returns a Promise resolving with true
if the device is running Android.
isIOS()
• Type
() => Promise<boolean>
• Details
Returns a Promise resolving with true
if the device is running iOS.
isMac()
• Type
() => Promise<boolean>
• Details
Returns a Promise resolving with true
if the device is running macOS.
openExternalLink()
• Type
(url: string) => Promise<boolean>
• Details
Expects a URL string, for example:
https://example.com
(web link)mailto:someone@example.com
(email link)myapp://open
(deep link to another app)
Returns a Promise that resolves with true
if the URL was opened successfully in a browser or installed app.
openSettings()
• Type
() => Promise<void>
• Details
Opens the system settings app for this application.
requestAppRate()
• Type
() => Promise<void>
• Details
Opens a native modal to allow the user to rate the app in the store.
On iOS, this uses the system-provided rating dialog. On Android, it typically opens the Google Play in-app review flow (or redirects to the Play Store if in-app review is not available).
Whether the modal is shown depends on the operating system, whether the user has already submitted a review, and the timing of previous requests.
It is recommended to request a rating only after a meaningful user action and not more often than once every few days.
requestPermission()
• Type
(permission: string) => Promise<void>
• Details
Expects one of the PERMISSION types (defined in plugin properties), for example: PERMISSION_CAMERA
, PERMISSION_FOREGROUND_LOCATION
.
Returns a Promise that resolves when the permission request completes.
scanBarcode()
• Type
(...types: string[]) => Promise<string>
• Details
Expects one or more BARCODE types (defined in plugin properties), for example: BARCODE_QR
, BARCODE_CODE128
.
Returns a Promise resolving with the scanned barcode string.
scanQrCode()
• Type
() => Promise<string>
• Details
Scans a QR code and returns a Promise resolving with the scanned string.
share()
• Type
(file: string | { id: string, name: string }, title?: string) => void
• Details
Expects a file ID string or a file object with id and name, and an optional title string.
Shares the file via the system’s native share dialog. If a title is provided, it will be used in the share prompt.
showStatusBar()
• Type
() => void
• Details
Displays the system status bar on mobile devices.