[General] Getting Mobile Device Information by JS

  • Last update:May 29, 2025
  • Overview

    Version

    Report Server VersionAPP Version/HTML5 Mobile Display Plugin VersionFunctional 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.91Supported 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 VersionParameter 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.

     通用1.png

    Save the template, and preview the report in the DataAnalyst app. The following figure shows the effect.

     通用2.png

    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 VersionParameter 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 modelModelApp: 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

    });

     通用3.png

    Save the template, and preview it in the DataAnalyst app. The following figure shows the effect.

     通用4.png

    Template Download

    Attachment List


    Theme: Secondary Development
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy