Upgrade(Android)
1、Send upgrade command, the device is disconnected from the network, and cannot reply to the MQTT result
2、The cabinet receives the upgrade command, requests HTTP, and obtains the latest version name and APK download address.
3、The cabinet determines whether it needs to be upgraded based on the APK version name
Command Send ▼
Subscribe to topic:/powerbank/{uuid}/user/get
Data format: JSON string
Name | Identification code | Data type | Remarks |
---|---|---|---|
command name | cmd | string | push_version_apk |
Upgrade APK
{ "cmd":"push_version_apk" }
Command Reply △
None, But Trigger API request
API Request
Tips
Server API address, only needs to return the correct Body data, no strict requirement on the request path. We recommend the following writing method:
GET APK
https://{host}/api/rentbox/client/version/main?id={id}
text
/api/rentbox/client/version/main
Request Parameters
Name | Identification code | Is it required | Remarks |
---|---|---|---|
Server domain name | host | YES | Provided by the customer, for example: s.abc.com |
Firmware ID | id | YES | Provided by the customer, for example: 1, 2, 3. Depending on the manufacturer and model, different IDs need to be passed in and different upgrade addresses are returned. Example: 1. Quectel master firmware 2. Quectel master firmware (backup power) 3. MeiG master firmware 4. MeiG master upgrade (backup power) 5. Android master firmware |
API Example
API Response
json
{
"code":200,
"type":0,
"data":"V12,100520,http://abc.com/apps/xxxxxx.apk",
"msg":"OK",
"time":1705479460869
}
Name | Identification code | Type | Remarks |
---|---|---|---|
status code | code | int | Default: 200 |
status type | type | int | Default: 0 |
Custom data | data | string | Upgrade parameters, "," split array |
Exception message | msg | string | Default: OK |
timestamp | time | long | current millisecond timestamp |
Upgrade Parameters
- | Name | Identification code | Type | Remarks |
---|---|---|---|---|
array[0] | version name | versionName | string | For example:V12 |
array[1] | APK length | fileSize | long | For example: 100520 |
array[2] | Download address | url | string | For example: http://abc.com/apps/xxxxxx.bin |