Last Updated on : 2024-09-06 06:18:07download
IDevice.getMeta().get("wifiEnable")
to get the Wi-Fi connection status. A value of true
indicates that the cloud-based activation is successful.System requirements: Android 4.3 or later. Smart Industry App SDK works with Android 6.0 and later.
Manifest permissions:
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<!-- Android 12 added -->
<uses-permission android:name="android.permission.BLUETOOTH_SCAN" />
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
Bluetooth permission precheck: It is performed before each Bluetooth scanning and connection. Otherwise, the app cannot use Bluetooth as expected.
Smart Industry App SDK does not provide the logic for precheck. You can implement it on your own.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
mode |
ActivatorMode |
Yes | The pairing mode. |
Example
BLEWIFICloudActivator blewifiCloudActivator = (BLEWIFICloudActivator) ActivatorService.activator(ActivatorMode.BLE_WIFI_ENABLE);
Get the parameters from the result of the scanning listener.
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
devId | String | Yes | The ID of the device. |
pwd | String | Yes | The password of the Wi-Fi network. |
ssid | String | Yes | The SSID of the Wi-Fi network. |
timeout | Long | No | The timeout for device activation in the cloud, in milliseconds. Default value: 100. |
BLEWIFICloudActivatorParams params = new BLEWIFICloudActivatorParams.Builder()
.setSsid(ssid)
.setPwd(password)
.setDevId(deviceId)
.setTimeout(60 * 1000)
.build();
blewifiCloudActivator.setParams(params);
Example
blewifiCloudActivator.setListener(new IActivatorListener() {
@Override
public void onSuccess(@Nullable IDevice iDevice) {
Log.d(TAG, "onSuccess: ");
}
@Override
public void onError(@NonNull String s, @NonNull String s1) {
Log.d(TAG, "onError: ");
}
});
This method starts the device pairing.
Example
blewifiCloudActivator.start();
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback