Well, I'm making a app
that has a MediaPlayer
plugin to play web radio .
I would like to add, when player
was clicked, a preview of it in the notifications area (I think that's the name) as well as below:
InthisimageIfound,whatIwantisthat,intheplacewhere"Leve Garoa, São Paulo" is written, put the Radio player just below, when I, there in the App
, click play .
The Gospel Mix app also does this.
The idea is that when App
is minimized, the user has the experience of viewing the plugin when displaying the notification area .
But player did not appear in the notification area .
Follow the code .
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
private void notificacao (){
RemoteViews remoteViews = new RemoteViews(this.getPackageName(), R.layout.player);
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.home)
.setContentTitle("Rádio Capital")
//.setCustomContentView(remoteViews)
.setContentText("Agora deu");
Intent resultIntent = new Intent(this, player.class);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
stackBuilder.addParentStack(player.class);
stackBuilder.addNextIntent(resultIntent);
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
mBuilder.setContentIntent(resultPendingIntent);
mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(1, mBuilder.build());
}