MediaManager
public
final
class
MediaManager
extends Object
| java.lang.Object | |
| ↳ | com.google.wear.services.media.MediaManager |
Provides a public interface for managing media auto-launch settings.
An instance of this class can be obtained directly via the Wear SDK by invoking com.google.wear.Sdk.getWearManager(Context,Class) API.
Summary
Constants | |
|---|---|
String |
ACTION_REMOTE_MEDIA_ACTIVITY
An intent action declared by media applications that can handle Remote media sessions. |
int |
MEDIA_AUTO_LAUNCH_STATE_DISABLED
Indicates that the auto-launch setting is disabled for the calling application. |
int |
MEDIA_AUTO_LAUNCH_STATE_ENABLED
Indicates that the auto-launch setting is enabled for the calling application. |
int |
MEDIA_AUTO_LAUNCH_STATE_UNKNOWN
Indicates that the auto-launch setting is not supported on the device or the setting state is unknown. |
Public methods | |
|---|---|
int
|
getMediaAutoLaunchState()
Checks if media auto-launch is enabled for the calling application. |
boolean
|
showMediaAutoLaunchSettings()
Launches the system's media auto-launch settings screen for this application. |
Inherited methods | |
|---|---|
Constants
ACTION_REMOTE_MEDIA_ACTIVITY
public static final String ACTION_REMOTE_MEDIA_ACTIVITY
An intent action declared by media applications that can handle Remote media sessions. The activity handling this intent would be associated with the media session fetched from the phone to the watch.
Constant Value: "com.google.wear.services.media.action.REMOTE_MEDIA_ACTIVITY"
MEDIA_AUTO_LAUNCH_STATE_DISABLED
public static final int MEDIA_AUTO_LAUNCH_STATE_DISABLED
Indicates that the auto-launch setting is disabled for the calling application.
Constant Value: 1 (0x00000001)
MEDIA_AUTO_LAUNCH_STATE_ENABLED
public static final int MEDIA_AUTO_LAUNCH_STATE_ENABLED
Indicates that the auto-launch setting is enabled for the calling application.
Constant Value: 2 (0x00000002)
MEDIA_AUTO_LAUNCH_STATE_UNKNOWN
public static final int MEDIA_AUTO_LAUNCH_STATE_UNKNOWN
Indicates that the auto-launch setting is not supported on the device or the setting state is unknown. It is recommended to disable auto-launch related features when this value is returned.
Constant Value: 0 (0x00000000)
Public methods
getMediaAutoLaunchState
public int getMediaAutoLaunchState ()
Checks if media auto-launch is enabled for the calling application.
This can be used by media apps to check whether their application will be auto-launched
when a media session starts on the connected phone. When enabled by the user, the activity
associated with the remote session will be launched. A media application may associate an
activity with the session by applying ACTION_REMOTE_MEDIA_ACTIVITY intent filter to
their activity.
| Returns | |
|---|---|
int |
The auto-launch state of the calling application.
Value is one of the following: |
showMediaAutoLaunchSettings
public boolean showMediaAutoLaunchSettings ()
Launches the system's media auto-launch settings screen for this application. This should be used by applications to allow users to toggle the media auto-launch preferences for the application.
| Returns | |
|---|---|
boolean |
true if the settings screen was launched, false otherwise. |