RemoteIntent
public
class
RemoteIntent
extends Object
java.lang.Object | |
↳ | com.google.android.wearable.intent.RemoteIntent |
Support for opening android intents on other devices.
The following example opens play store for the given app on another device:
RemoteIntent.startRemoteActivity(context, nodeId, new Intent(Intent.ACTION_VIEW) .setData(Uri.parse("http://play.google.com/store/apps/details?id=com.example.myapp")), null);
Summary
Constants | |
---|---|
int |
RESULT_FAILED
Result code passed to |
int |
RESULT_OK
Result code passed to |
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 | |
---|---|
![]()
java.lang.Object
|
Constants
RESULT_FAILED
int RESULT_FAILED
Result code passed to send(int, Bundle)
when a remote intent failed to send.
Constant Value: 1 (0x00000001)
RESULT_OK
int RESULT_OK
Result code passed to send(int, Bundle)
when a remote intent was sent successfully.
Constant Value: 0 (0x00000000)
Public constructors
RemoteIntent
RemoteIntent ()
Public methods
startRemoteActivity
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 ACTION_VIEW
, a data uri populated using setData(Uri)
, and with the category 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 ACTION_VIEW , a data uri must be populated using setData(Uri) , and the
category 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
void startRemoteActivity (Context context, Intent intent, ResultReceiver resultReceiver)
Start an activity on another device. This api currently supports sending intents with action
set to ACTION_VIEW
, a data uri populated using setData(Uri)
, and with the category 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 ACTION_VIEW , a data uri must be populated using setData(Uri) , and the category CATEGORY_BROWSABLE must be present. |
resultReceiver |
ResultReceiver : An optional ResultReceiver to receive callbacks for the request.
|
Classes