DeviceAPI Introduction

DeviceAPI is a collection of objects that allow you to use mobile device functions in the Nexacro Platform app. It allows the app to use mobile device dependent functions, such as Bluetooth, Wi-Fi, camera, GPS, storage device, and sensor. The objects and functions currently supported are as follows. Please refer to Help in Nexacro Studio for more information on each object.

Object

Description

Acceleration

This is the object that can obtain acceleration information of the mobile device.

AudioPlayer

This is the audio player object.

AudioRecorder

This is the audio recorder object.

Camera

This is the object that obtains images using the camera app of the mobile device.

Contact

This is the object that manages contacts.

ContactAddress

This is the object that manages the address information of contacts.

ContactField

This is the object that manages the fields of contact information.

ContactOrganization

This is the object that manages the organizational information of contacts.

ContactPhoto

This is the object that manages photo information of contacts.

ContactSet

This is the object that searches/adds/deletes/updates contacts.

ExternalAPI

This is the object used when connecting to external devices, modules, and apps.

FileDialog

This is the file selection dialog box object that sets the path when opening or saving the file.

Geolocation

This is the object that provides location information.

ImagePicker

This is the object that imports images from the album app.

LiteDBConnection

This is the object that provides connection information with the database.

LiteDBStatement

This is the object that performs queries to the database.

Network

This is the object that provides network connection information.

Phone

This is the object that provides the dialing function.

Sms

This is the object that provides the function of sending and receiving short messages.

Vibrator

This is the object that manages the vibration function.

Using DeviceAPI Object

DeviceAPI is not registered as a default component of Nexacro Studio as it is the function that operates only in the mobile environment. Therefore, to use the DeviceAPI object, the process of user registration in Nexacro Studio is required.

The process of the DeviceAPI object use registration is as follows.

1

Double-click [TypeDefinition > Objects] in Project Explorer of Nexacro Studio to open the Objects editor.

typedefinition_objects_editor

2

If you click the + button at the bottom of the Objects table on the right side of the editor and select the required object item, then a new object is added at the bottom. The information of the object registered in the table can be modified, but the default value is used, except in special cases. Click the – button next to the object name to delete the added object.

3

Click the OK button after adding all the required objects. Then, the registered objects are reflected in the project and the project is automatically rebuilt. The added objects can be used immediately and can be checked in the Nexacro Studio toolbar as follows.

toolbar

Mobile Device Resource Access Privilege in App

You require access privileges to the mobile device resource to perform functions using DeviceAPI in the app. Since Android and iOS use sandbox policies, they require appropriate privileges when accessing resources other than the app’s own data. Among those privileges, important privileges that may affect user privacy or other apps are required to be explicitly granted by the user.

For example, when performing the photo-taking function, the app informs the user that the following privilege is required and asks for it to be granted. Once the privilege is granted by the user, the privilege is no longer requested until the privilege setting is changed or the app is updated.

Screenshot_20190211-164715

If the access privilege is not granted, then the app function will not be operated, and the user will be notified of the privilege required to perform the function.

Screenshot_20190211-164729

The status of the privileges granted to the app can be checked in the settings menu of the mobile device. The privileges already granted or denied by the user can be reset here as well.

Screenshot_20190211-164506

The required privilege may be displayed differently depending on the mobile operating system or security policy.