my.getSystemInfo
This API is supported in mPaaS 10.1.32 and later versions.
This interface is used for system information.
Input parameter
Name | Type | Required | Description |
---|---|---|---|
success | Function | No | Callback function for successful call |
fail | Function | No | Callback function for failed call |
complete | Function | No | Callback function for ended call (executed regardless of whether the call is successful or failed) |
success return value
Name | Type | Description | Minimum Version |
---|---|---|---|
model | String | Phone model | - |
pixelRatio | Number | Device pixel ratio | - |
windowWidth | Number | Window width | - |
windowHeight | Number | Window height | - |
language | String | Language set by the application | - |
version | String | Application version number | - |
storage | String | Device disk capacity | 1.1.1 |
currentBattery | String | Percentage of current battery | 1.1.1 |
system | String | System version | 1.1.1 |
platform | String | System name: Android, iOS / iPhone OS | 1.1.1 |
titleBarHeight | Number | Title bar height Description: This return value is only supported by version 10.1.60. |
1.1.1 |
statusBarHeight | Number | Status bar height Description: This return value is only supported by version 10.1.60. |
1.1.1 |
screenWidth | Number | Screen width | 1.1.1 |
screenHeight | Number | Screen height | 1.1.1 |
brand | String | Mobile phone brand | 1.4.0 |
fontSizeSetting | Number | Users set font size Description: This return value is only supported by version 10.1.60. |
1.4.0 |
app | String | The currently running client. | - |
Model parameter
For iPhone, the iPhone internal code (Internal Name) is returned in the model parameter. The iPhone model and the corresponding model return values are shown in the following table:
iPhone model | model return value |
---|---|
iPhone | iPhone11 |
iPhone 3G | iPhone12 |
iPhone 3GS | iPhone21 |
iPhone 4 | iPhone31 / iPhone32 / iPhone33 |
iPhone 4S | iPhone41 |
iPhone 5 | iPhone51 / iPhone52 |
iPhone 5S | iPhone61 / iPhone62 |
iPhone 6 | iPhone72 |
iPhone 6 Plus | iPhone71 |
iPhone 6S | iPhone8,1 |
iPhone 6S Plus | iPhone8,2 |
iPhone 7 | iPhone9,1 / iPhone9,3 |
iPhone 7 Plus | iPhone9,2 / iPhone9,4 |
iPhone 8 | iPhone10,1 / iPhone10,4 |
iPhone 8 Plus | iPhone10,2 / iPhone10,5 |
iPhone X | iPhone10,3 / iPhone10,6 |
iPhone XR | iPhone11,8 |
iPhone XS | iPhone11,2 |
iPhone 11 | iPhone12,1 |
iPhone 11 Pro | iPhone12,3 |
iPhone XS Max | iPhone11,6 / iPhone11,4 |
iPhone 11 Pro Max | iPhone12,5 |
Code sample
// API-DEMO page/API/get-system-info/get-system-info.json
{
"defaultTitle": "Get phone system info"
}
<!-- API-DEMO page/API/get-system-info/get-system-info.axml-->
<view class="page">
<view class="page-section">
<view class="page-section-demo">
<text>Phone model</text>
<input type="text" disabled="{{true}}" value="{{systemInfo.model}}"></input>
</view>
<view class="page-section-demo">
<text>Language</text>
<input type="text" disabled="{{true}}" value="{{systemInfo.language}}"></input>
</view>
<view class="page-section-demo">
<text>Version</text>
<input type="text" disabled="{{true}}" value="{{systemInfo.version}}"></input>
</view>
<view class="page-section-demo">
<text>Window width</text>
<input type="text" disabled="{{true}}" value="{{systemInfo.windowWidth}}"></input>
</view>
<view class="page-section-demo">
<text>Window height</text>
<input type="text" disabled="{{true}}" value="{{systemInfo.windowHeight}}"></input>
</view>
<view class="page-section-demo">
<text>DPI</text>
<input type="text" disabled="{{true}}" value="{{systemInfo.pixelRatio}}"></input>
</view>
<view class="page-section-btns">
<view onTap="getSystemInfo">Get phone system info</view>
<view onTap="getSystemInfoSync">Get phone system info synchronously</view>
</view>
</view>
</view>
// API-DEMO page/API/get-system-info/get-system-info.js
Page({
data: {
systemInfo: {}
},
getSystemInfo() {
my.getSystemInfo({
success: (res) => {
this.setData({
systemInfo: res
})
}
})
},
getSystemInfoSync() {
this.setData({
systemInfo: my.getSystemInfoSync(),
});
},
})
my.getSystemInfoSync
This API is supported in mPaaS 10.1.32 and later versions.
A synchronization interface for obtaining mobile phone system information. The return value is the same as the success callback parameter of getSystemInfo
.
This interface is a synchronous interface and has a timeout judgment. When it times out, the interface returns undefined.
Code sample
// API-DEMO page/API/get-system-info/get-system-info.json
{
"defaultTitle": "Get phone system info"
}
<!-- API-DEMO page/API/get-system-info/get-system-info.axml-->
<view class="page">
<view class="page-section">
<view class="page-section-demo">
<text>Phone model</text>
<input type="text" disabled="{{true}}" value="{{systemInfo.model}}"></input>
</view>
<view class="page-section-demo">
<text>Language</text>
<input type="text" disabled="{{true}}" value="{{systemInfo.language}}"></input>
</view>
<view class="page-section-demo">
<text>Version</text>
<input type="text" disabled="{{true}}" value="{{systemInfo.version}}"></input>
</view>
<view class="page-section-demo">
<text>window width</text>
<input type="text" disabled="{{true}}" value="{{systemInfo.windowWidth}}"></input>
</view>
<view class="page-section-demo">
<text>Window height</text>
<input type="text" disabled="{{true}}" value="{{systemInfo.windowHeight}}"></input>
</view>
<view class="page-section-demo">
<text>DPI</text>
<input type="text" disabled="{{true}}" value="{{systemInfo.pixelRatio}}"></input>
</view>
<view class="page-section-btns">
<view onTap="getSystemInfo">Get phone system info</view>
<view onTap="getSystemInfoSync">Get phone system info synchronously</view>
</view>
</view>
</view>
// API-DEMO page/API/get-system-info/get-system-info.js
Page({
data: {
systemInfo: {}
},
getSystemInfo() {
my.getSystemInfo({
success: (res) => {
this.setData({
systemInfo: res
})
}
})
},
getSystemInfoSync() {
this.setData({
systemInfo: my.getSystemInfoSync(),
});
},
})