@@ -25,6 +25,8 @@ import androidx.wear.remote.interactions.RemoteActivityHelper
2525import androidx.wear.widget.ConfirmationOverlay
2626import androidx.wear.widget.ConfirmationOverlay.OPEN_ON_PHONE_ANIMATION
2727import 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
2830import com.google.android.gms.wearable.CapabilityClient
2931import com.google.android.gms.wearable.Wearable
3032import kotlinx.coroutines.guava.await
@@ -75,21 +77,17 @@ class LaunchOnPhoneActivity : ComponentActivity() {
7577 CapabilityClient .FILTER_REACHABLE ,
7678 )
7779 .await()
78- return if (capabilities.nodes.isNotEmpty()) {
79- capabilities.nodes.first().id
80- } else {
81- null
82- }
80+ return capabilities.nodes.firstOrNull()?.id
8381 }
8482
8583 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())
8785 intent.addCategory(Intent .CATEGORY_BROWSABLE )
8886 return intent
8987 }
9088
9189 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())
9391 intent.addCategory(Intent .CATEGORY_BROWSABLE )
9492 return intent
9593 }
0 commit comments