-
public abstract class DataLayerAppHelperBase class on which of the Wear and Phone DataLayerAppHelpers are build.
Provides utility functions for determining installation status and means to install and launch apps as part of the user's journey.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classDataLayerAppHelper.Companion
-
Field Summary
Fields Modifier and Type Field Description private final Flow<Set<Node>>connectedAndInstalledNodes
-
Constructor Summary
Constructors Constructor Description DataLayerAppHelper(Context context, WearDataLayerRegistry registry)
-
Method Summary
Modifier and Type Method Description abstract Flow<Set<Node>>getConnectedAndInstalledNodes()Creates a flow to keep the client updated with the set of connected devices with the app installed. final List<AppHelperNodeStatus>connectedNodes()Provides a list of connected nodes and the installation status of the app on these nodes. abstract AppHelperResultCodeinstallOnNode(String nodeId)Launches to the appropriate store on the specified node to allow installation of the app. abstract AppHelperResultCodestartCompanion(String nodeId)Starts the companion that relates to the specified node. final AppHelperResultCodestartRemoteActivity(String nodeId, ActivityConfig config)Launch an activity, which belongs to the same app (same package name), on the specified node. final AppHelperResultCodestartRemoteOwnApp(String nodeId)Launch own app on the specified node. final BooleanisAvailable()Check whether the data layer is available before use to avoid crashes. -
-
Constructor Detail
-
DataLayerAppHelper
DataLayerAppHelper(Context context, WearDataLayerRegistry registry)
-
-
Method Detail
-
getConnectedAndInstalledNodes
abstract Flow<Set<Node>> getConnectedAndInstalledNodes()
Creates a flow to keep the client updated with the set of connected devices with the app installed.
When called from a phone device, multiple watches can be connected to it.
When called from a watch device, usually only a single phone device will be connected to it.
-
connectedNodes
final List<AppHelperNodeStatus> connectedNodes()
Provides a list of connected nodes and the installation status of the app on these nodes.
-
installOnNode
abstract AppHelperResultCode installOnNode(String nodeId)
Launches to the appropriate store on the specified node to allow installation of the app.
- Parameters:
nodeId- The node to launch on.
-
startCompanion
@CheckResult() abstract AppHelperResultCode startCompanion(String nodeId)
Starts the companion that relates to the specified node. This will start on the phone, irrespective of whether the specified node is a phone or a watch.
When called from a watch node, it is required that the same app is installed on the specified node, otherwise a timeout is expected. See AppHelperNodeStatus.appInstallationStatus in order to check the installation status.
- Parameters:
nodeId- The node to launch on.
-
startRemoteActivity
@CheckResult() final AppHelperResultCode startRemoteActivity(String nodeId, ActivityConfig config)
Launch an activity, which belongs to the same app (same package name), on the specified node.
Class name should be a fully qualified class name, such as, "com.example.project.SampleActivity".
This call requires that the same app is installed on the specified node, otherwise a timeout is expected. See AppHelperNodeStatus.appInstallationStatus in order to check the installation status.
-
startRemoteOwnApp
@CheckResult() final AppHelperResultCode startRemoteOwnApp(String nodeId)
Launch own app on the specified node.
This call requires that the same app is installed on the specified node, otherwise a timeout is expected. See AppHelperNodeStatus.appInstallationStatus in order to check the installation status.
-
isAvailable
final Boolean isAvailable()
Check whether the data layer is available before use to avoid crashes.
-
-
-
-