Skip to content

Commit

Permalink
Example projects updated to use release 5.1.0
Browse files Browse the repository at this point in the history
- Get disk space feature example added for both platforms
  • Loading branch information
Samuli Määttä committed May 10, 2023
1 parent b96266c commit 43d4a38
Show file tree
Hide file tree
Showing 17 changed files with 1,668 additions and 1,554 deletions.
2 changes: 1 addition & 1 deletion demos/Android-Demos/PolarSDK-ECG-HR-Demo/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ android {
}

dependencies {
implementation 'com.github.polarofficial:polar-ble-sdk:5.0.2'
implementation 'com.github.polarofficial:polar-ble-sdk:5.1.0'
implementation 'com.androidplot:androidplot-core:1.5.10'
implementation 'io.reactivex.rxjava3:rxjava:3.1.6'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ android {
}

dependencies {
implementation 'com.github.polarofficial:polar-ble-sdk:5.0.2'
implementation 'com.github.polarofficial:polar-ble-sdk:5.1.0'
implementation 'io.reactivex.rxjava3:rxjava:3.1.6'
implementation 'io.reactivex.rxjava3:rxandroid:3.0.2'
implementation 'androidx.appcompat:appcompat:1.6.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class MainActivity : AppCompatActivity() {
}

// ATTENTION! Replace with the device ID from your device.
private var deviceId = "968BEA2E"
private var deviceId = "8C4E5023"

private val api: PolarBleApi by lazy {
// Notice all features are enabled
Expand Down Expand Up @@ -94,6 +94,7 @@ class MainActivity : AppCompatActivity() {
private lateinit var setTimeButton: Button
private lateinit var getTimeButton: Button
private lateinit var toggleSdkModeButton: Button
private lateinit var getDiskSpaceButton: Button

//Verity Sense offline recording use
private lateinit var listRecordingsButton: Button
Expand Down Expand Up @@ -128,6 +129,7 @@ class MainActivity : AppCompatActivity() {
setTimeButton = findViewById(R.id.set_time)
getTimeButton = findViewById(R.id.get_time)
toggleSdkModeButton = findViewById(R.id.toggle_SDK_mode)
getDiskSpaceButton = findViewById(R.id.get_disk_space)
//Verity Sense recording buttons
listRecordingsButton = findViewById(R.id.list_recordings)
startRecordingButton = findViewById(R.id.start_recording)
Expand Down Expand Up @@ -844,6 +846,18 @@ class MainActivity : AppCompatActivity() {
}
}

getDiskSpaceButton.setOnClickListener {
api.getDiskSpace(deviceId)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
{ diskSpace ->
Log.d(TAG, "disk space: $diskSpace")
showToast("Disk space left: ${diskSpace.freeSpace}/${diskSpace.totalSpace} Bytes")
},
{ error: Throwable -> Log.e(TAG, "get disk space 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)
Expand Down Expand Up @@ -982,6 +996,7 @@ class MainActivity : AppCompatActivity() {
setTimeButton.isEnabled = false
getTimeButton.isEnabled = false
toggleSdkModeButton.isEnabled = false
getDiskSpaceButton.isEnabled = false
//Verity Sense recording buttons
listRecordingsButton.isEnabled = false
startRecordingButton.isEnabled = false
Expand Down Expand Up @@ -1010,6 +1025,7 @@ class MainActivity : AppCompatActivity() {
setTimeButton.isEnabled = true
getTimeButton.isEnabled = true
toggleSdkModeButton.isEnabled = true
getDiskSpaceButton.isEnabled = true
//Verity Sense recording buttons
listRecordingsButton.isEnabled = true
startRecordingButton.isEnabled = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,12 @@
android:layout_height="wrap_content"
android:text="@string/get_time" />

<Button
android:id="@+id/get_disk_space"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/get_disk_space" />

<View
android:layout_width="match_parent"
android:layout_height="1dp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@
<string name="stop_recording">stop verity sense recording</string>
<string name="download_recording">download one verity sense recording</string>
<string name="delete_recording">delete one verity sense recording</string>
<string name="get_disk_space">Get disk space</string>
</resources>
2 changes: 1 addition & 1 deletion examples/example-ios/iosBleSdkTestApp/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ platform :ios, '15.0'
use_frameworks!

target 'iosBleSdkTestApp' do
pod 'PolarBleSdk', '5.0.2'
pod 'PolarBleSdk', '5.1.0'
end
8 changes: 4 additions & 4 deletions examples/example-ios/iosBleSdkTestApp/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
PODS:
- PolarBleSdk (5.0.2):
- PolarBleSdk (5.1.0):
- RxSwift (~> 6.5.0)
- SwiftProtobuf (~> 1.0)
- RxSwift (6.5.0)
- SwiftProtobuf (1.21.0)

DEPENDENCIES:
- PolarBleSdk (= 5.0.2)
- PolarBleSdk (= 5.1.0)

SPEC REPOS:
https://github.com/CocoaPods/Specs.git:
Expand All @@ -15,10 +15,10 @@ SPEC REPOS:
- SwiftProtobuf

SPEC CHECKSUMS:
PolarBleSdk: 5d1d9792a1fee9d5b4f26f7c54a7eb57988d5d3e
PolarBleSdk: 4ff4df5c3767b6c31673ada5537dc259278cc008
RxSwift: 5710a9e6b17f3c3d6e40d6e559b9fa1e813b2ef8
SwiftProtobuf: afced68785854575756db965e9da52bbf3dc45e7

PODFILE CHECKSUM: 03f19b71504ae65c395fd213b6e571e4cb68c2d1
PODFILE CHECKSUM: 1751472de49b7355b8c3024af5c35fb40289ae27

COCOAPODS: 1.12.0
8 changes: 4 additions & 4 deletions examples/example-ios/iosBleSdkTestApp/Pods/Manifest.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 43d4a38

Please sign in to comment.