A service to provide status bar notifications when casting. This service will start when a
media session begins, and will stop when the media session ends. This service builds
media-style notification, which includes an album art image, a title and up to 5 action
buttons, based on the options provided inNotificationOptions
.
The album art image is picked from the list of images of theMediaMetadata
of the current item. If
CastMediaOptions.getImagePicker()
is provided it will be used to pick the image,
with the type
ImagePicker.IMAGE_TYPE_NOTIFICATION_THUMBNAIL
.If no image is available,
R.drawable.cast_album_art_placeholder
and
R.drawable.cast_album_art_placeholder_large
will be used, depending on the screen
size. They can be overridden by the application.
The title is set to the value keyed byMediaMetadata.KEY_TITLE
in the metadata of the current item.
The list of action buttons is set to
NotificationOptions.getActions()
,seeMediaIntentReceiver
for the list of available actions.
The notification icon in the status bar is set to
R.drawable.cast_ic_notification_small_icon
.This can be overridden by the
application.
Constant Summary
String | ACTION_UPDATE_NOTIFICATION | The action for updating the notification. |
Inherited Constant Summary
int | START_CONTINUATION_MASK | |
int | START_FLAG_REDELIVERY | |
int | START_FLAG_RETRY | |
int | START_NOT_STICKY | |
int | START_REDELIVER_INTENT | |
int | START_STICKY | |
int | START_STICKY_COMPATIBILITY | |
int | STOP_FOREGROUND_DETACH | |
int | STOP_FOREGROUND_LEGACY | |
int | STOP_FOREGROUND_REMOVE |
String | ACCESSIBILITY_SERVICE | |
String | ACCOUNT_SERVICE | |
String | ACTIVITY_SERVICE | |
String | ALARM_SERVICE | |
String | APPWIDGET_SERVICE | |
String | APP_OPS_SERVICE | |
String | APP_SEARCH_SERVICE | |
String | AUDIO_SERVICE | |
String | BATTERY_SERVICE | |
int | BIND_ABOVE_CLIENT | |
int | BIND_ADJUST_WITH_ACTIVITY | |
int | BIND_ALLOW_ACTIVITY_STARTS | |
int | BIND_ALLOW_OOM_MANAGEMENT | |
int | BIND_AUTO_CREATE | |
int | BIND_DEBUG_UNBIND | |
int | BIND_EXTERNAL_SERVICE | |
long | BIND_EXTERNAL_SERVICE_LONG | |
int | BIND_IMPORTANT | |
int | BIND_INCLUDE_CAPABILITIES | |
int | BIND_NOT_FOREGROUND | |
int | BIND_NOT_PERCEPTIBLE | |
int | BIND_SHARED_ISOLATED_PROCESS | |
int | BIND_WAIVE_PRIORITY | |
String | BIOMETRIC_SERVICE | |
String | BLOB_STORE_SERVICE | |
String | BLUETOOTH_SERVICE | |
String | BUGREPORT_SERVICE | |
String | CAMERA_SERVICE | |
String | CAPTIONING_SERVICE | |
String | CARRIER_CONFIG_SERVICE | |
String | CLIPBOARD_SERVICE | |
String | COMPANION_DEVICE_SERVICE | |
String | CONNECTIVITY_DIAGNOSTICS_SERVICE | |
String | CONNECTIVITY_SERVICE | |
String | CONSUMER_IR_SERVICE | |
int | CONTEXT_IGNORE_SECURITY | |
int | CONTEXT_INCLUDE_CODE | |
int | CONTEXT_RESTRICTED | |
String | CREDENTIAL_SERVICE | |
String | CROSS_PROFILE_APPS_SERVICE | |
int | DEVICE_ID_DEFAULT | |
int | DEVICE_ID_INVALID | |
String | DEVICE_LOCK_SERVICE | |
String | DEVICE_POLICY_SERVICE | |
String | DISPLAY_HASH_SERVICE | |
String | DISPLAY_SERVICE | |
String | DOMAIN_VERIFICATION_SERVICE | |
String | DOWNLOAD_SERVICE | |
String | DROPBOX_SERVICE | |
String | EUICC_SERVICE | |
String | FILE_INTEGRITY_SERVICE | |
String | FINGERPRINT_SERVICE | |
String | GAME_SERVICE | |
String | GRAMMATICAL_INFLECTION_SERVICE | |
String | HARDWARE_PROPERTIES_SERVICE | |
String | HEALTHCONNECT_SERVICE | |
String | INPUT_METHOD_SERVICE | |
String | INPUT_SERVICE | |
String | IPSEC_SERVICE | |
String | JOB_SCHEDULER_SERVICE | |
String | KEYGUARD_SERVICE | |
String | LAUNCHER_APPS_SERVICE | |
String | LAYOUT_INFLATER_SERVICE | |
String | LOCALE_SERVICE | |
String | LOCATION_SERVICE | |
String | MEDIA_COMMUNICATION_SERVICE | |
String | MEDIA_METRICS_SERVICE | |
String | MEDIA_PROJECTION_SERVICE | |
String | MEDIA_ROUTER_SERVICE | |
String | MEDIA_SESSION_SERVICE | |
String | MIDI_SERVICE | |
int | MODE_APPEND | |
int | MODE_ENABLE_WRITE_AHEAD_LOGGING | |
int | MODE_MULTI_PROCESS | |
int | MODE_NO_LOCALIZED_COLLATORS | |
int | MODE_PRIVATE | |
int | MODE_WORLD_READABLE | |
int | MODE_WORLD_WRITEABLE | |
String | NETWORK_STATS_SERVICE | |
String | NFC_SERVICE | |
String | NOTIFICATION_SERVICE | |
String | NSD_SERVICE | |
String | OVERLAY_SERVICE | |
String | PEOPLE_SERVICE | |
String | PERFORMANCE_HINT_SERVICE | |
String | POWER_SERVICE | |
String | PRINT_SERVICE | |
int | RECEIVER_EXPORTED | |
int | RECEIVER_NOT_EXPORTED | |
int | RECEIVER_VISIBLE_TO_INSTANT_APPS | |
String | RESTRICTIONS_SERVICE | |
String | ROLE_SERVICE | |
String | SEARCH_SERVICE | |
String | SENSOR_SERVICE | |
String | SHORTCUT_SERVICE | |
String | STATUS_BAR_SERVICE | |
String | STORAGE_SERVICE | |
String | STORAGE_STATS_SERVICE | |
String | SYSTEM_HEALTH_SERVICE | |
String | TELECOM_SERVICE | |
String | TELEPHONY_IMS_SERVICE | |
String | TELEPHONY_SERVICE | |
String | TELEPHONY_SUBSCRIPTION_SERVICE | |
String | TEXT_CLASSIFICATION_SERVICE | |
String | TEXT_SERVICES_MANAGER_SERVICE | |
String | TV_INPUT_SERVICE | |
String | TV_INTERACTIVE_APP_SERVICE | |
String | UI_MODE_SERVICE | |
String | USAGE_STATS_SERVICE | |
String | USB_SERVICE | |
String | USER_SERVICE | |
String | VIBRATOR_MANAGER_SERVICE | |
String | VIBRATOR_SERVICE | |
String | VIRTUAL_DEVICE_SERVICE | |
String | VPN_MANAGEMENT_SERVICE | |
String | WALLPAPER_SERVICE | |
String | WIFI_AWARE_SERVICE | |
String | WIFI_P2P_SERVICE | |
String | WIFI_RTT_RANGING_SERVICE | |
String | WIFI_SERVICE | |
String | WINDOW_SERVICE |
int | TRIM_MEMORY_BACKGROUND | |
int | TRIM_MEMORY_COMPLETE | |
int | TRIM_MEMORY_MODERATE | |
int | TRIM_MEMORY_RUNNING_CRITICAL | |
int | TRIM_MEMORY_RUNNING_LOW | |
int | TRIM_MEMORY_RUNNING_MODERATE | |
int | TRIM_MEMORY_UI_HIDDEN |
Public Constructor Summary
Public Method Summary
static boolean |
isNotificationOptionsValid(CastOptions
options)
Returns true if
NotificationOptions in theCastOptions
provides valid actions.
|
IBinder | |
void |
onCreate()
|
void | |
int |
onStartCommand(Intent
intent, int flags, int startId)
|
Inherited Method Summary
void |
attachBaseContext(Context
arg0)
|
void | |
finalApplication |
getApplication()
|
final int |
getForegroundServiceType()
|
abstractIBinder |
onBind(Intent
arg0)
|
void |
onConfigurationChanged(Configuration
arg0)
|
void |
onCreate()
|
void |
onDestroy()
|
void |
onLowMemory()
|
void |
onRebind(Intent
arg0)
|
void |
onStart(Intent
arg0, int arg1)
|
int |
onStartCommand(Intent
arg0, int arg1, int arg2)
|
void |
onTaskRemoved(Intent
arg0)
|
void |
onTimeout(int arg0)
|
void |
onTrimMemory(int arg0)
|
boolean |
onUnbind(Intent
arg0)
|
final void |
startForeground(int arg0,Notification
arg1)
|
final void |
startForeground(int arg0,Notification
arg1, int arg2)
|
final void |
stopForeground(int arg0)
|
final void |
stopForeground(boolean arg0)
|
final void |
stopSelf()
|
final void |
stopSelf(int arg0)
|
final boolean |
stopSelfResult(int arg0)
|
void |
attachBaseContext(Context
arg0)
|
boolean | |
boolean | |
boolean | |
boolean | |
boolean | |
boolean | |
boolean |
bindServiceAsUser(Intent
arg0,ServiceConnection
arg1, Context.BindServiceFlags arg2,UserHandle
arg3)
|
int |
checkCallingOrSelfPermission(Stringarg0)
|
int |
checkCallingOrSelfUriPermission(Uriarg0, int
arg1)
|
int[] | |
int |
checkCallingPermission(Stringarg0)
|
int |
checkCallingUriPermission(Uriarg0, int
arg1)
|
int[] | |
int |
checkPermission(Stringarg0,
int arg1, int arg2)
|
int |
checkSelfPermission(Stringarg0)
|
int | |
int |
checkUriPermission(Uriarg0, int
arg1, int arg2, int arg3)
|
int[] | |
void |
clearWallpaper()
|
Context |
createAttributionContext(Stringarg0)
|
Context |
createConfigurationContext(Configuration
arg0)
|
Context |
createContext(ContextParams arg0)
|
Context |
createContextForSplit(Stringarg0)
|
Context |
createDeviceContext(int arg0)
|
Context |
createDeviceProtectedStorageContext()
|
Context |
createDisplayContext(Display
arg0)
|
Context |
createPackageContext(Stringarg0,
int arg1)
|
Context |
createWindowContext(int arg0,Bundlearg1)
|
Context | |
String[] |
databaseList()
|
boolean |
deleteDatabase(Stringarg0)
|
boolean |
deleteFile(Stringarg0)
|
boolean |
deleteSharedPreferences(Stringarg0)
|
void | |
void | |
void | |
void | |
void | |
void | |
void | |
String[] |
fileList()
|
Context |
getApplicationContext()
|
ApplicationInfo |
getApplicationInfo()
|
AssetManager |
getAssets()
|
AttributionSource |
getAttributionSource()
|
String |
getAttributionTag()
|
Context |
getBaseContext()
|
File |
getCacheDir()
|
ClassLoader |
getClassLoader()
|
File |
getCodeCacheDir()
|
ContentResolver |
getContentResolver()
|
File |
getDataDir()
|
File |
getDatabasePath(Stringarg0)
|
int |
getDeviceId()
|
File |
getDir(Stringarg0,
int arg1)
|
Display |
getDisplay()
|
File |
getExternalCacheDir()
|
File[] |
getExternalCacheDirs()
|
File |
getExternalFilesDir(Stringarg0)
|
File[] |
getExternalFilesDirs(Stringarg0)
|
File[] |
getExternalMediaDirs()
|
File |
getFileStreamPath(Stringarg0)
|
File |
getFilesDir()
|
Executor |
getMainExecutor()
|
Looper |
getMainLooper()
|
File |
getNoBackupFilesDir()
|
File |
getObbDir()
|
File[] |
getObbDirs()
|
String |
getOpPackageName()
|
String |
getPackageCodePath()
|
PackageManager |
getPackageManager()
|
String |
getPackageName()
|
String |
getPackageResourcePath()
|
ContextParams |
getParams()
|
Resources |
getResources()
|
SharedPreferences |
getSharedPreferences(Stringarg0,
int arg1)
|
Object |
getSystemService(Stringarg0)
|
String |
getSystemServiceName(Class<?>
arg0)
|
Resources.Theme |
getTheme()
|
Drawable |
getWallpaper()
|
int |
getWallpaperDesiredMinimumHeight()
|
int |
getWallpaperDesiredMinimumWidth()
|
void | |
boolean |
isDeviceProtectedStorage()
|
boolean |
isRestricted()
|
boolean |
isUiContext()
|
boolean | |
boolean | |
FileInputStream |
openFileInput(Stringarg0)
|
FileOutputStream |
openFileOutput(Stringarg0,
int arg1)
|
SQLiteDatabase |
openOrCreateDatabase(Stringarg0,
int arg1,
SQLiteDatabase.CursorFactoryarg2,
DatabaseErrorHandlerarg3)
|
SQLiteDatabase | |
Drawable |
peekWallpaper()
|
void |
registerComponentCallbacks(ComponentCallbacks
arg0)
|
void | |
Intent | |
Intent | |
Intent | |
Intent | |
void |
removeStickyBroadcast(Intent
arg0)
|
void | |
void | |
void |
revokeUriPermission(Uriarg0, int
arg1)
|
void | |
void | |
void | |
void |
sendBroadcast(Intent
arg0)
|
void | |
void | |
void | |
void | |
void | |
void | |
void | |
void | |
void |
sendOrderedBroadcastAsUser(Intent
arg0,UserHandle
arg1,Stringarg2,
BroadcastReceiver
arg3,Handler
arg4, int arg5,Stringarg6,
Bundlearg7)
|
void |
sendStickyBroadcast(Intent
arg0)
|
void | |
void | |
void |
sendStickyOrderedBroadcast(Intent
arg0,BroadcastReceiver
arg1,Handler
arg2, int arg3,Stringarg4,
Bundlearg5)
|
void |
sendStickyOrderedBroadcastAsUser(Intent
arg0,UserHandle
arg1,BroadcastReceiver
arg2,Handler
arg3, int arg4,Stringarg5,
Bundlearg6)
|
void |
setTheme(int arg0)
|
void |
setWallpaper(Bitmap
arg0)
|
void |
setWallpaper(InputStream
arg0)
|
void | |
void |
startActivities(Intent[]
arg0)
|
void |
startActivity(Intent
arg0)
|
void | |
ComponentName |
startForegroundService(Intent
arg0)
|
boolean | |
void | |
void | |
ComponentName |
startService(Intent
arg0)
|
boolean |
stopService(Intent
arg0)
|
void |
unbindService(ServiceConnection
arg0)
|
void |
unregisterComponentCallbacks(ComponentCallbacks
arg0)
|
void |
unregisterDeviceIdChangeListener(IntConsumer
arg0)
|
void |
unregisterReceiver(BroadcastReceiver
arg0)
|
void |
updateServiceGroup(ServiceConnection
arg0, int arg1, int arg2)
|
boolean | |
boolean |
bindIsolatedService(Intent
arg0, Context.BindServiceFlags arg1,Stringarg2,
Executor
arg3,ServiceConnection
arg4)
|
boolean | |
boolean | |
abstract boolean | |
boolean | |
boolean | |
boolean |
bindServiceAsUser(Intent
arg0,ServiceConnection
arg1, Context.BindServiceFlags arg2,UserHandle
arg3)
|
abstract int |
checkCallingOrSelfPermission(Stringarg0)
|
abstract int |
checkCallingOrSelfUriPermission(Uriarg0, int
arg1)
|
int[] | |
abstract int |
checkCallingPermission(Stringarg0)
|
abstract int |
checkCallingUriPermission(Uriarg0, int
arg1)
|
int[] | |
abstract int |
checkPermission(Stringarg0,
int arg1, int arg2)
|
abstract int |
checkSelfPermission(Stringarg0)
|
abstract int | |
abstract int |
checkUriPermission(Uriarg0, int
arg1, int arg2, int arg3)
|
int[] | |
abstract void |
clearWallpaper()
|
Context |
createAttributionContext(Stringarg0)
|
abstractContext |
createConfigurationContext(Configuration
arg0)
|
Context |
createContext(ContextParams arg0)
|
abstractContext |
createContextForSplit(Stringarg0)
|
Context |
createDeviceContext(int arg0)
|
abstractContext |
createDeviceProtectedStorageContext()
|
abstractContext |
createDisplayContext(Display
arg0)
|
abstractContext |
createPackageContext(Stringarg0,
int arg1)
|
Context |
createWindowContext(int arg0,Bundlearg1)
|
Context | |
abstractString[] |
databaseList()
|
abstract boolean |
deleteDatabase(Stringarg0)
|
abstract boolean |
deleteFile(Stringarg0)
|
abstract boolean |
deleteSharedPreferences(Stringarg0)
|
abstract void | |
abstract void | |
abstract void | |
abstract void | |
abstract void | |
abstract void | |
abstract void | |
abstractString[] |
fileList()
|
abstractContext |
getApplicationContext()
|
abstractApplicationInfo |
getApplicationInfo()
|
abstractAssetManager |
getAssets()
|
AttributionSource |
getAttributionSource()
|
String |
getAttributionTag()
|
abstractFile |
getCacheDir()
|
abstractClassLoader |
getClassLoader()
|
abstractFile |
getCodeCacheDir()
|
final int |
getColor(int arg0)
|
finalColorStateList |
getColorStateList(int arg0)
|
abstractContentResolver |
getContentResolver()
|
abstractFile |
getDataDir()
|
abstractFile |
getDatabasePath(Stringarg0)
|
int |
getDeviceId()
|
abstractFile |
getDir(Stringarg0,
int arg1)
|
Display |
getDisplay()
|
finalDrawable |
getDrawable(int arg0)
|
abstractFile |
getExternalCacheDir()
|
abstractFile[] |
getExternalCacheDirs()
|
abstractFile |
getExternalFilesDir(Stringarg0)
|
abstractFile[] |
getExternalFilesDirs(Stringarg0)
|
abstractFile[] |
getExternalMediaDirs()
|
abstractFile |
getFileStreamPath(Stringarg0)
|
abstractFile |
getFilesDir()
|
Executor |
getMainExecutor()
|
abstractLooper |
getMainLooper()
|
abstractFile |
getNoBackupFilesDir()
|
abstractFile |
getObbDir()
|
abstractFile[] |
getObbDirs()
|
String |
getOpPackageName()
|
abstractString |
getPackageCodePath()
|
abstractPackageManager |
getPackageManager()
|
abstractString |
getPackageName()
|
abstractString |
getPackageResourcePath()
|
ContextParams |
getParams()
|
abstractResources |
getResources()
|
abstractSharedPreferences |
getSharedPreferences(Stringarg0,
int arg1)
|
finalString |
getString(int arg0,Object...
arg1)
|
finalString |
getString(int arg0)
|
final <T> T |
getSystemService(Class<T>
arg0)
|
abstractObject |
getSystemService(Stringarg0)
|
abstractString |
getSystemServiceName(Class<?>
arg0)
|
finalCharSequence |
getText(int arg0)
|
abstractResources.Theme |
getTheme()
|
abstractDrawable |
getWallpaper()
|
abstract int |
getWallpaperDesiredMinimumHeight()
|
abstract int |
getWallpaperDesiredMinimumWidth()
|
abstract void | |
abstract boolean |
isDeviceProtectedStorage()
|
boolean |
isRestricted()
|
boolean |
isUiContext()
|
abstract boolean | |
abstract boolean | |
finalTypedArray |
obtainStyledAttributes(AttributeSet
arg0, int[] arg1)
|
finalTypedArray |
obtainStyledAttributes(AttributeSet
arg0, int[] arg1, int arg2, int arg3)
|
finalTypedArray |
obtainStyledAttributes(int arg0, int[] arg1)
|
finalTypedArray |
obtainStyledAttributes(int[] arg0)
|
abstractFileInputStream |
openFileInput(Stringarg0)
|
abstractFileOutputStream |
openFileOutput(Stringarg0,
int arg1)
|
abstract SQLiteDatabase |
openOrCreateDatabase(Stringarg0,
int arg1,
SQLiteDatabase.CursorFactoryarg2,
DatabaseErrorHandlerarg3)
|
abstract SQLiteDatabase | |
abstractDrawable |
peekWallpaper()
|
void |
registerComponentCallbacks(ComponentCallbacks
arg0)
|
void | |
abstractIntent | |
abstractIntent | |
abstractIntent | |
abstractIntent | |
abstract void |
removeStickyBroadcast(Intent
arg0)
|
abstract void | |
void |
revokeSelfPermissionOnKill(Stringarg0)
|
void | |
abstract void |
revokeUriPermission(Uriarg0, int
arg1)
|
abstract void | |
void | |
abstract void | |
abstract void |
sendBroadcast(Intent
arg0)
|
abstract void | |
abstract void | |
void | |
void | |
abstract void | |
void | |
void | |
abstract void | |
abstract void |
sendOrderedBroadcastAsUser(Intent
arg0,UserHandle
arg1,Stringarg2,
BroadcastReceiver
arg3,Handler
arg4, int arg5,Stringarg6,
Bundlearg7)
|
abstract void |
sendStickyBroadcast(Intent
arg0)
|
void | |
abstract void | |
abstract void |
sendStickyOrderedBroadcast(Intent
arg0,BroadcastReceiver
arg1,Handler
arg2, int arg3,Stringarg4,
Bundlearg5)
|
abstract void |
sendStickyOrderedBroadcastAsUser(Intent
arg0,UserHandle
arg1,BroadcastReceiver
arg2,Handler
arg3, int arg4,Stringarg5,
Bundlearg6)
|
abstract void |
setTheme(int arg0)
|
abstract void |
setWallpaper(Bitmap
arg0)
|
abstract void |
setWallpaper(InputStream
arg0)
|
abstract void | |
abstract void |
startActivities(Intent[]
arg0)
|
abstract void |
startActivity(Intent
arg0)
|
abstract void | |
abstractComponentName |
startForegroundService(Intent
arg0)
|
abstract boolean | |
abstract void | |
abstract void | |
abstractComponentName |
startService(Intent
arg0)
|
abstract boolean |
stopService(Intent
arg0)
|
abstract void |
unbindService(ServiceConnection
arg0)
|
void |
unregisterComponentCallbacks(ComponentCallbacks
arg0)
|
void |
unregisterDeviceIdChangeListener(IntConsumer
arg0)
|
abstract void |
unregisterReceiver(BroadcastReceiver
arg0)
|
void |
updateServiceGroup(ServiceConnection
arg0, int arg1, int arg2)
|
abstract void |
onTrimMemory(int arg0)
|
abstract void |
onConfigurationChanged(Configuration
arg0)
|
abstract void |
onLowMemory()
|
Constants
public static finalString ACTION_UPDATE_NOTIFICATION
The action for updating the notification.
Public Constructors
publicMediaNotificationService()
Public Methods
public static booleanisNotificationOptionsValid(CastOptions options)
Returns true if
NotificationOptions
in theCastOptions
provides valid actions.