DeviceService

Overview

SERVICE This class is a "service" and it is automatically injected if declared as a member in the constructor of the consuming class. - See the constructor section below for details - See the Automatic Instance Injection page for details on the topic

The DeviceService class provides methods to work device/platform specific features

No properties

There is a difference in the behaviour of the DeviceService API in mobile and backend apps.

▶️ logOut(): Promise<void>

logOut method performs user logout from the application and navigates to application login screen

sync(): Promise<void>

sync method opens the application synchronization screen and performs full synchronization of the app. It can be used only in mobile applications and does not have effect in backend applications.

hideOnScreenKeyboard(): Promise<void>

hideKeyboard method hides the mobile on-screen keyboard. The method can be used only in mobile apps and does not have effect in backend apps.

isNFCSupported(): Promise<boolean>

isNFCSupported method returns true if the mobile device supports NFC ( near field communication). The method can be used only in mobile apps and does not have effect in backend apps.

readNFCTag(): Promise<string>

readNFCTag method activates NFC and tries to read nearby NFC tag and returns the tag reading

barcodeScan(): Promise<{content: string, success: boolean, message: string, format: string }>

barcodeScan method activates the device-camera barcode scanning. It opens the device camera app and allows the user to scan a barcode.

getPlatformType(): Promise<PlatformType>

getPlatformType method returns the type of the platform where the app is running.

getInfo(): Promise<DeviceInfo>

getInfo method returns system information obtained from the device.

openWebBrowser(): Promise<void>

openWebBrowser method opens a given url in the default web browser on the device.

takePicture(): Promise<void>

takePicture method opens the device camera and allows the user to take a picture. The user can confirm or cancel the picture taking. The method returns the url pointing to a selected picture file.

selectPicture(): Promise<{ url: string }>

selectPicture method opens the Picture Selection dialog on the device, where the user can select one picture. The method returns the url pointing to a selected picture file.

getBTDevices(): Promise<Array<stirng>>

getBTDevices returns a list of with the names of bluetooth devices, currently paired with the mobile device. Can be used in mobile apps only.

beepOk(): Promise<void>

beepOk method plays a short ok-alike sound on the mobile device. Can be used in mobile apps only. Can be used after successful operations like successful barcode scan for example.

beepDoubleOk(): Promise<void>

beepDoubleOk method plays a two times ok-alike sound on the mobile device. Can be used in mobile apps only. Can be used after successful operations like successful barcode scan for example.

beepError(): Promise<void>

beepError method plays a short error alike sound on the mobile device. Can be used in mobile apps only. Can be used after successful operations like successful barcode scan for example.

location.get(precision:number): Promise<{latitude: number; longitude: number; speed: number; accuracy: number;}>

location.get method obtains the current device geographic location from the device's location subsystem like GPS, WiFi or Cellular network.

Last updated

Dynamics Mobile provided by Mobile Affairs Ltd. | 1712 Sofia, Bulgaria, Alexander Malinov 51 | sales@dynamicsmobile.com