I am using the ExoPlayer Cast Extension for playing an audio stream on a connected chromecast device.
The notification appears automatically when a Chromecast Session is connected.
How can i remove the progress bar from the notification? Could not find anything in the documentation.
Remove setMediaSession() from your MediaStyle().
Not using or assigning the token to mediaSession would mean that you won't have the controls you need to control your media service, also you loose feature like automatic setting of color(color temperature auto-detected from album-art) on your notification and would need to write custom indents for controlling the player.
Related
My app can play music from the internet. For control, I use a push notification with buttons for pause/play and rewind. I create it via NotificationCompat Builder and set the MediaStyle. On the lock screen, MediaSessionCompat displays a full-screen notification for monitoring. But there is also a duplicate of the first notification. Because of this, I have two notifications on the lock screen.
Perhaps the MediaSession itself should hide the notification by its id or channel? I tried setting VISIBILITY_SECRET to the channel and notification, but it also displayed on the lock screen.
This may be behavior specific to your phone; I would first start by checking what the behavior is on an emulator.
Perhaps you'd like to compare how you're registering your MediaSession in the notification against the Universal Android Music Player Sample. In particular, check if you've set the MediaSession token with the MediaStyle notification using setMediaSession(); you can find how this is accomplished inside UAMP inside UampNotificationManager.
I am using ExoPlayer in foreground service together with MediaStyle notification and MediaSessionToken to control playback. I also want to be able to Cast the content to Google Cast receiver. This could be the normal use case for every music player.
The cast is creating its own notification so I have 2 notifications to control the same playback which is bad UX.
I have found this SO question link to disable the default cast notification by setting .setNotificationOptions(null). The problem is that the system creates another notification "A device on your Wi-Fi is casting" as seen on the screenshot. This is the notification that is shown on every device in the same network.
My question is: Is it possible to share the same notification for foreground service and cast service?
Or at least tell the system that this is the device that is actually sending the cast, so it won't show the silent system notification "A device on your Wi-Fi is casting" on that particular device?
Thank you.
We have created a video app for Android and we have also connected it with the Chromecast library. We created a Mini Controller in the notification bar and lock screen using this exact code here.
Problem: the Mini Controller can be dismissed as a regular notification instead staying sticky, like the Mini Controller in the YouTube app.
I have found how to make a sticky regular notification, but not how to alter the one given in the Chromecast Docs.
You are probably using deprecated SDK version (v2?) in which the notification is not sticky. If you do casting using the new Cast SDK (Cast Application Framework (CAF)), the notification will be sticky automatically.
Trying to stop "Kijiji" from making noise every time I get a reply but the app has no way to disable the notification sound.
Any way to disable the notification sounds via ADB? I know you can disable vibration for specific apps so I think you can disable notification sounds also.
I am trying to play Notification Sound without disturbing other Music playing
Notification Sound can be played by 2 ways
1) Played by OS itself via NotificationBuilder
Benifits:- Handle itself all the cases of not playing sound in Phone Calls and other cases as well
Problem:- When music is playing and notification comes, then it shifts audio focus from music to notification, there by lowering or silencing music depending on how that music player app has handled the loss in audio focus.
2) We play sound via our media Player whenever notification comes
A) Play on NOTIFICATION STREAM ---> works perfectly fine but gives probem of ducking when played via earphones
B) Play on SYSTEM STREAM
Benifits:- No shifting of audio focus, so no effect on music when notification comes
Problem:- We will have to handle other cases of not playing sound in Telephonic call and VOIP as well...and may be other not known cases as of now .
But I figured it that watsup is doing fine.
So don't know how it is doing it
Per the Android 5.0 behavior changes on notification sounds:
If you are currently adding sounds and vibrations to your notifications by using the Ringtone, MediaPlayer, or Vibrator classes, remove this code so that the system can present notifications correctly in priority mode. Instead, use Notification.Builder methods to add sounds and vibration.
Setting the device to RINGER_MODE_SILENT causes the device to enter the new priority mode. The device leaves priority mode if you set it to RINGER_MODE_NORMAL or RINGER_MODE_VIBRATE.
Previously, Android used STREAM_MUSIC as the master stream to control volume on tablet devices. In Android 5.0, the master volume stream for both phone and tablet devices is now unified, and is controlled by STREAM_RING or STREAM_NOTIFICATION.
As there is not a direct way to detect whether a device is in priority mode, you should always use the Notification.Builder/NotificationCompat.Builder methods to add sound to your notifications to ensure you meet the user's expectations.