Overview
Version
Report Server Version | APP Version/HTML5 Mobile Display Plugin Version | Functional Change |
---|---|---|
11.0 | V 11.0 | Supported the DataAnalyst app only. |
11.0 | V11.0.86 | Added the FR.Mobile.getDeviceInfo().DeviceID API in the HTML5 terminal where the FR.Mobile.getDeviceInfo().DModel API is not supported. |
11.0 | V11.0.91 | Supported the APIs in this document in FineReport with the FineVis Data Visualization plugin of V2.6.0 or later versions. |
Application Scenario
The mobile terminal allows you to use APIs to obtain the device information in JSON format. The returned JSON object includes the device model (Model) and the unique device identifier (DeviceID).
General Report
API Description
In a general report, you can use the API FR.Mobile.getDeviceInfo() to obtain the device information in JSON format.
The example of the returned value: {Model:\"iPhone 11 Pro Max\", DeviceID: \"2A345464-067D-4695A1CC-65C38D7BD9EO\"}
Returned parameter description:
Attribute | Name | Version | Parameter Value |
---|---|---|---|
Unique ID of the device | DeviceID | App: always supported HTML5: supported in V11.0.86 and later versions | IOS: Advertising ID Android: MAC address |
Device model | Model | App: always supported HTML5: not supported yet | IOS: device model, for example, iPhone 11 Pro Max. Android: device model, for example, 2A345464-067D-4695A1CC-65C38D7BD9EO. |
Example
Add a Loading End event in Pagination Preview Setting with the following JavaScript code, which allows the device model and unique device ID to pop up for display.
var deviceInfo = FR.Mobile.getDeviceInfo();
FR.Msg.alert("Model: " + deviceInfo.Model + "\n DeviceID: " + deviceInfo.DeviceID);
The following figure shows the steps.
Save the template, and preview the report in the DataAnalyst app. The following figure shows the effect.
FVS Visualization Dashboard
API Description
In an FVS visualization dashboard, you can use the API duchamp.getDeviceInfo() to obtain the device information in JSON format.
Returned parameter description:
Attribute | Name | Version | Parameter Value |
---|---|---|---|
Unique ID of the device | DeviceID | App: always supported HTML5: supported in V11.0.86 and later versions
| IOS: Advertising ID Android: MAC address |
Device model | Model | App: always supported HTML5: not supported yet | IOS: device model, for example, iPhone 11 Pro Max. Android: device model, for example, 2A345464-067D-4695A1CC-65C38D7BD9EO. |
Example
In an FVS visualization dashboard, add a title component, and add a JavaScript interaction event for the component with the following JavaScript code:
var deviceInfo = duchamp.getDeviceInfo();
duchamp.Msg.alert({
title: deviceInfo.Model,
message: deviceInfo.DeviceID
});
Save the template, and preview it in the DataAnalyst app. The following figure shows the effect.
Template Download
For details, you can download the templates:
[App] Getting Mobile Device Information by JS.cpt
Getting Mobile Device Information by JS.fvs