1
Well, I’m making one app
that has a plugin MediaPlayer
to play web radio.
I would like to add, when the player
was clicked, a prediction of it in the notification area (I think that’s the name) also as below:
In this image I found, what I wish is that, in the place where it is written "Leve Garoa, São Paulo", put the player of Radio just below, when I, there App
, click on play.
The app radio Gospel Mix also does that.
The idea is that when the App
is minimized, the user has the experience to view the plugin when to display the notification area.
But the player in notification area.
Follows 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());
}