RemoteIntent

public class RemoteIntent
extends Object

java.lang.Object
   ↳ com.google.android.wearable.intent.RemoteIntent


This class is deprecated.
use androidx.wear.remote.interactions.RemoteActivityHelper provided by the Jetpack Wear Remote Interactions library instead.

Support for opening android intents on other devices.

The following example opens play store for the given app on another device:

 RemoteIntent.startRemoteActivity(context, new Intent(Intent.ACTION_VIEW)
     .setData(Uri.parse("http://play.google.com/store/apps/details?id=com.example.myapp")),
     null, nodeId);
 

Summary

Constants

int RESULT_FAILED

Result code passed to ResultReceiver.send(int, Bundle) when a remote intent failed to send.

int RESULT_OK

Result code passed to ResultReceiver.send(int, Bundle) when a remote intent was sent successfully.

Public constructors

RemoteIntent()

Public methods

static void startRemoteActivity(Context context, Intent intent, ResultReceiver resultReceiver, String nodeId)

Start an activity on another device.

static void startRemoteActivity(Context context, Intent intent, ResultReceiver resultReceiver)

Start an activity on another device.

Inherited methods

Constants

RESULT_FAILED

public static final int RESULT_FAILED

Result code passed to ResultReceiver.send(int, Bundle) when a remote intent failed to send.

Constant Value: 1 (0x00000001)

RESULT_OK

public static final int RESULT_OK

Result code passed to ResultReceiver.send(int, Bundle) when a remote intent was sent successfully.

Constant Value: 0 (0x00000000)

Public constructors

RemoteIntent

public RemoteIntent ()

Public methods

startRemoteActivity

public static void startRemoteActivity (Context context, 
                Intent intent, 
                ResultReceiver resultReceiver, 
                String nodeId)

Start an activity on another device. This api currently supports sending intents with action set to Intent.ACTION_VIEW, a data uri populated using Intent.setData(Uri), and with the category Intent.CATEGORY_BROWSABLE present.

Parameters
context Context: Context for sending the intent.

intent Intent: The intent to open on the remote device. Action must be set to Intent.ACTION_VIEW, a data uri must be populated using Intent.setData(Uri), and the category Intent.CATEGORY_BROWSABLE must be present.

resultReceiver ResultReceiver: An optional ResultReceiver to receive callbacks for the request.

nodeId String: Wear OS node id for the device where the activity should be started. If null, and the current device is a watch, the activity will start on the companion phone device. Otherwise, the activity will start on all connected watch devices.

startRemoteActivity

public static void startRemoteActivity (Context context, 
                Intent intent, 
                ResultReceiver resultReceiver)

Start an activity on another device. This api currently supports sending intents with action set to Intent.ACTION_VIEW, a data uri populated using Intent.setData(Uri), and with the category Intent.CATEGORY_BROWSABLE present. If the current device is a watch, the activity will start on the companion phone device. Otherwise, the activity will start on all connected watch devices.

Parameters
context Context: Context for sending the intent.

intent Intent: The intent to open on the remote device. Action must be set to Intent.ACTION_VIEW, a data uri must be populated using Intent.setData(Uri), and the category Intent.CATEGORY_BROWSABLE must be present.

resultReceiver ResultReceiver: An optional ResultReceiver to receive callbacks for the request.