Open URL on phone from watch face

Viewed 937

I have a watch face that I've created and I was looking into adding an "About" screen in the watch settings (on the watch). This screen would show the current version and show a button to open a URL leading to a changelog. I want the user to be able to click the button on their watch, and have it open the specified URL on the phone.

Is this possible without me creating a mobile companion application?

2 Answers

Note the new way to do this is with RemoteActivityHelper:

    val remoteActivityHelper = RemoteActivityHelper(context, Executors.newSingleThreadExecutor())
    val result = remoteActivityHelper.startRemoteActivity(
        Intent(Intent.ACTION_VIEW)
          .addCategory(Intent.CATEGORY_BROWSABLE)
          .setData(
            Uri.parse("http://www.google.com/")
          ),
        null
    )

and if you want to show the nice "Open on phone" animation, use ConfirmationActivity:

   startActivity(
      Intent(this, ConfirmationActivity::class.java)
        .putExtra(ConfirmationActivity.EXTRA_ANIMATION_TYPE, ConfirmationActivity.OPEN_ON_PHONE_ANIMATION))
Related