# Equipment certification SDK (Android)

Note: License Billing is no longer supported using device authentication SDK Certified devices, please switch to theuse WMPF Certified Equipment, No Maintenance DeviceToken, easier access.

In System Integration rpmbd After that, the developer needs to be in Launcher Application Access Device Certification SDK,SDK Mainly provide the following capabilities:

  • Registration device registerDevice: Will model_id and SN Binding with the device. And once it does, model_id and SN Non-modifiable
  • Get Equipment Credentials getDeviceToken: Authenticate the device and get the certificate from the WeChat background, and send it to the device when the call is initiated. VOIP The call plug-in initByCaller Interface VoipToken Parameters.

# 1. to download SDK

Please contact us at [this place](https://git.weixin.qq.com /wxa_iot/voipsdk/) to download SDK of aar Documents.

Suggested Use 1.3 And above (IoT cards should be used 1.3.1 And above versions). Low version does not support concurrent calls registerVoipDevice, be sure not to repeat the call until the previous call returns.

  • v1.5.0 And above versions need to be integrated voipsdk-x.x-release.aarand safeguard-release.aar Two aar file
  • v1.3.1 And the following versions only need to be integrated voipsdk-x.x-release.aar

Note: Use Device Certification SDK First, make sure. RMPBD The service is functioning normally.

# 2. Interface documentation (v1.5.0 and above)

# 2.1 Registration device registerDevice

will model_id and SN Tied to the device. Once successful, appid, model _ID, SN None can be replaced.

int registerDevice(String appid,  String model_id, String sn, String sn_ticket) throws Exception

# Considerations (Must Read Before Call

  • When the device is successfully registered, it will be SN Cure to EMMC/RPMB Partition, mark the unique identity of this device.SN and model_id Cannot be changed once written
  • Used here. SN, must go through the WMPF of [addDevice](https://developers.weixin.qq.com/doc/oplatform /Miniprogram_Frame/api/backend/addDevice.html) Interface as the deviceId Registration, and with the WMPF [Device activation](https://developers.weixin.qq.com/doc/oplatform /Miniprogram_Frame/api/cli/boot/init.html) Used deviceId Consistent. Otherwise, subsequent calls cannot be initiated normally.
  • After successful registration will be in this APK To store a digital certificate, if APK There are changes (Android The system believes that the application has changed), the certificate is invalid (an error will be reportedcert fail), which can be cleaned APK The data is then**The same appid, model _ID, SN **Call the interface to reapply.
  • There will be a network request during the registration process, and the duration will vary depending on the network. High version android Do not allow network requests in the main thread, can be added processing or in the thread to call sdk。

# Dxplaination of parameters

parameter type Introductions
appid String Mini Program. appid
model_id String Device accessWhen fromMini Program management backgroundApplication obtained model_id
sn String Device serial number. Manufacturer's own generation, the length can not exceed 128 Bytes. Characters accept only numbers, upper and lower case letters, underscores (*) and hyphen (-).
Used here. sn Must be associated with WMPF Activation device used by the deviceId Agreement
sn_ticket String adoptGet Equipment TicketsInterface acquisition

# Return value

For other exception descriptions, please refer to theDevice Validation FAQ

name value describe
OK 0 success
ERR_ARGS -1 Parameter error
ERR_IO -2 currency IO error
ERR_KEY_IO -3 KEY Does not match
ERR_RESPONSE -4 Network Request No Reply
ERR_PEM -5 Permission error
ERR_INVALID_KEY -6 KEY Not available
ERR_SERVICE -7 rpmbd Service not running
ERR_EMMC_UFS_CONFUSED -8 EMMC/UFS No match. It already exists. SN
ERR_EMMC_UFS_IO -9 EMMC/UFS IO error
ERR_REG_NOPEM -10 The key does not exist.

# 2.2 Get Equipment Credentials getDeviceToken

Conduct device authentication and get device credentials from WeChat background. When the device initiates a call, it needs to pass this certificate to VOIP The call plug-in initByCaller Interface VoipToken Parameters.

String getDeviceToken (String appid,  String model_id) throws Exception

If the device is used v1.5 And above version SDK To register a device, you can use a non-parametric version.

String getDeviceToken () throws Exception

# Dxplaination of parameters

parameter type Introductions
appid String Mini Program. appid
model_id String Device accessWhen fromMini Program management backgroundApplication obtained model_id

# Note

  • The interface time is network related, normal will be in 1 Seconds or so. High version android Not allowed in the main thread, can add processing or in the thread to call sdk。
  • ticket It has a one-hour validity period and can be reused for multiple calls within an hour. It is recommended that developers call ahead of time before the user initiates a call getCallerTicket And cache to avoid getting it when initiating a call, so as to shorten the waiting time of the user when initiating a call.

# 2.3 Get the device SN getDeviceSn(For debugging only)

Obtain registerDevice Written by the interface SN。

String getDeviceSn()

# 2.4 Get the device modelId getDeviceModelid(For debugging only)

Get the use of registerDevice Written by the interface modelId。Only if the device is used v1.5 And above version SDK Valid when registering a device.

String getDeviceModelid ()

# 3. Interface Documentation (v1.3.1 And the following version)

# 3.1 to initialize init

SDK Initialization, other interfaces need to be guaranteed before calling init Success.

boolean init()

# 3.2 Registration device registerVoipDevice

reference 2.1 registerDevice

  • **1.3 The following version SDK, this interface forbids concurrent execution**♪ be sure to guarantee once in the logic registerVoipDevice It cannot be called again until it returns.

# 3.3 Get Dialing Party Tickets getCallerTicket

reference 2.2 getDeviceToken

# 3.4 Get the device SN GetDeviceSn(For debugging only)

with 2.3 getDeviceSn