-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
7 changed files
with
86 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
stempo/src/main/java/com/kkkk/stempo/presentation/home/HomeViewModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
stempo/src/main/java/com/kkkk/stempo/presentation/manager/WearableDataManger.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.kkkk.stempo.presentation.manager | ||
|
||
import com.google.android.gms.tasks.Task | ||
import com.google.android.gms.wearable.DataClient | ||
import com.google.android.gms.wearable.DataItem | ||
import com.google.android.gms.wearable.PutDataMapRequest | ||
import com.google.android.gms.wearable.PutDataRequest | ||
import timber.log.Timber | ||
|
||
class WearableDataManager(private val dataClient: DataClient) { | ||
|
||
fun sendIntToPhone(path: String, key: String, value: Int): Task<DataItem> { | ||
|
||
Timber.tag("okhttp").d("START SENDING DATA TO PHONE") | ||
|
||
val putDataReq: PutDataRequest = PutDataMapRequest.create(path).run { | ||
dataMap.putInt(key, value) | ||
asPutDataRequest().setUrgent() | ||
} | ||
|
||
return dataClient.putDataItem(putDataReq).addOnSuccessListener { dataItem -> | ||
Timber.tag("okhttp").d("SEND DATA TO PHONE SUCCESS : ${dataItem.uri}") | ||
}.addOnFailureListener { exception -> | ||
Timber.tag("okhttp").d("SEND DATA TO PHONE FAIL : ${exception.message}") | ||
} | ||
} | ||
|
||
companion object { | ||
const val KEY_RECORD = "KEY_RECORD" | ||
|
||
const val PATH_RECORD = "/record" | ||
} | ||
} |