@@ -25,6 +25,8 @@ import androidx.wear.remote.interactions.RemoteActivityHelper
25
25
import androidx.wear.widget.ConfirmationOverlay
26
26
import androidx.wear.widget.ConfirmationOverlay.OPEN_ON_PHONE_ANIMATION
27
27
import com.android.developers.androidify.wear.common.WearableConstants.ANDROIDIFY_INSTALLED_PHONE
28
+ import com.android.developers.androidify.wear.common.WearableConstants.ANDROIDIFY_LAUNCH_URL
29
+ import com.android.developers.androidify.wear.common.WearableConstants.ANDROIDIFY_PLAY_URL
28
30
import com.google.android.gms.wearable.CapabilityClient
29
31
import com.google.android.gms.wearable.Wearable
30
32
import kotlinx.coroutines.guava.await
@@ -75,21 +77,17 @@ class LaunchOnPhoneActivity : ComponentActivity() {
75
77
CapabilityClient .FILTER_REACHABLE ,
76
78
)
77
79
.await()
78
- return if (capabilities.nodes.isNotEmpty()) {
79
- capabilities.nodes.first().id
80
- } else {
81
- null
82
- }
80
+ return capabilities.nodes.firstOrNull()?.id
83
81
}
84
82
85
83
private fun getPlayIntent (): Intent {
86
- val intent = Intent (Intent .ACTION_VIEW , " market://details?id= $packageName " .toUri())
84
+ val intent = Intent (Intent .ACTION_VIEW , " $ANDROIDIFY_PLAY_URL $packageName" .toUri())
87
85
intent.addCategory(Intent .CATEGORY_BROWSABLE )
88
86
return intent
89
87
}
90
88
91
89
private fun getAndroidifyIntent (): Intent {
92
- val intent = Intent (Intent .ACTION_VIEW , " androidify://launch " .toUri())
90
+ val intent = Intent (Intent .ACTION_VIEW , ANDROIDIFY_LAUNCH_URL .toUri())
93
91
intent.addCategory(Intent .CATEGORY_BROWSABLE )
94
92
return intent
95
93
}
0 commit comments