diff --git a/examples/example-android/androidBleSdkTestApp/app/build.gradle b/examples/example-android/androidBleSdkTestApp/app/build.gradle index 6f797ce4..cae0601f 100644 --- a/examples/example-android/androidBleSdkTestApp/app/build.gradle +++ b/examples/example-android/androidBleSdkTestApp/app/build.gradle @@ -27,7 +27,7 @@ android { } dependencies { - implementation 'com.github.polarofficial:polar-ble-sdk:5.1.0' + implementation 'com.github.polarofficial:polar-ble-sdk:5.4.0' implementation 'io.reactivex.rxjava3:rxjava:3.1.6' implementation 'io.reactivex.rxjava3:rxandroid:3.0.2' implementation 'androidx.appcompat:appcompat:1.6.1' diff --git a/examples/example-android/androidBleSdkTestApp/app/src/main/java/com/polar/androidblesdk/MainActivity.kt b/examples/example-android/androidBleSdkTestApp/app/src/main/java/com/polar/androidblesdk/MainActivity.kt index 9698ea01..51966eb6 100644 --- a/examples/example-android/androidBleSdkTestApp/app/src/main/java/com/polar/androidblesdk/MainActivity.kt +++ b/examples/example-android/androidBleSdkTestApp/app/src/main/java/com/polar/androidblesdk/MainActivity.kt @@ -34,7 +34,7 @@ class MainActivity : AppCompatActivity() { } // ATTENTION! Replace with the device ID from your device. - private var deviceId = "8C4E5023" + private var deviceId = "BC15022D" private val api: PolarBleApi by lazy { // Notice all features are enabled @@ -48,7 +48,8 @@ class MainActivity : AppCompatActivity() { PolarBleApi.PolarBleSdkFeature.FEATURE_POLAR_OFFLINE_RECORDING, PolarBleApi.PolarBleSdkFeature.FEATURE_POLAR_ONLINE_STREAMING, PolarBleApi.PolarBleSdkFeature.FEATURE_POLAR_DEVICE_TIME_SETUP, - PolarBleApi.PolarBleSdkFeature.FEATURE_DEVICE_INFO + PolarBleApi.PolarBleSdkFeature.FEATURE_DEVICE_INFO, + PolarBleApi.PolarBleSdkFeature.FEATURE_POLAR_LED_ANIMATION ) ) } @@ -95,6 +96,8 @@ class MainActivity : AppCompatActivity() { private lateinit var getTimeButton: Button private lateinit var toggleSdkModeButton: Button private lateinit var getDiskSpaceButton: Button + private lateinit var changeLedAnimationStatusButton: Button + private lateinit var doFactoryResetButton: Button //Verity Sense offline recording use private lateinit var listRecordingsButton: Button @@ -130,6 +133,9 @@ class MainActivity : AppCompatActivity() { getTimeButton = findViewById(R.id.get_time) toggleSdkModeButton = findViewById(R.id.toggle_SDK_mode) getDiskSpaceButton = findViewById(R.id.get_disk_space) + changeLedAnimationStatusButton = findViewById(R.id.change_led_animation_status) + doFactoryResetButton = findViewById(R.id.do_factory_reset) + //Verity Sense recording buttons listRecordingsButton = findViewById(R.id.list_recordings) startRecordingButton = findViewById(R.id.start_recording) @@ -858,6 +864,36 @@ class MainActivity : AppCompatActivity() { ) } + var enableAnimation = false + changeLedAnimationStatusButton.setOnClickListener { + api.enableLedAnimation(deviceId, enableAnimation) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe( + { + Log.d(TAG, "ledAnimationEnabled set to $enableAnimation") + showToast("ledAnimationEnabled set to $enableAnimation") + changeLedAnimationStatusButton.text = + if (enableAnimation) getString(R.string.disable_led_animation) else getString( + R.string.enable_led_animation + ) + enableAnimation = !enableAnimation + }, + { error: Throwable -> Log.e(TAG, "changeLedAnimationStatus failed: $error") } + ) + } + + doFactoryResetButton.setOnClickListener { + api.doFactoryReset(deviceId, preservePairingInformation = true) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe( + { + Log.d(TAG, "send do factory reset to device") + showToast("send do factory reset to device") + }, + { error: Throwable -> Log.e(TAG, "doFactoryReset() failed: $error") } + ) + } + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { requestPermissions(arrayOf(Manifest.permission.BLUETOOTH_SCAN, Manifest.permission.BLUETOOTH_CONNECT), PERMISSION_REQUEST_CODE) diff --git a/examples/example-android/androidBleSdkTestApp/app/src/main/res/layout/activity_main.xml b/examples/example-android/androidBleSdkTestApp/app/src/main/res/layout/activity_main.xml index f9a8c62d..61f18ded 100644 --- a/examples/example-android/androidBleSdkTestApp/app/src/main/res/layout/activity_main.xml +++ b/examples/example-android/androidBleSdkTestApp/app/src/main/res/layout/activity_main.xml @@ -203,5 +203,17 @@ android:layout_height="wrap_content" android:text="@string/delete_recording" /> +