View player in the Android notifications area

12

I created an application that transmits a Streaming of the radio, but if I "minimize" the application it continues to play.

So I'd like to know how I can get you to open a box on Android's notifications list, like the Play Music

IjustthinktherealandbiggestdifferencebetweenappsisthatmyradioismadebyPhonegapwhichboilsdowntoHTML5insteadofpurejava.

    
asked by anonymous 18.09.2015 / 23:40

2 answers

1

You can use the Cordova Music Controls Plugin

cordova plugin add https://github.com/homerours/cordova-music-controls-plugin

It's very easy to integrate with your app.

    
21.08.2016 / 00:51
1

You can set up a custom notification, and you can add more useful information to the user. When setting up your notification, if you want to put your own layout (and therefore more information to the user) you would need to add the "Builder.setStyle ()" function.

An example would look like this:

NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this)
    .setSmallIcon(R.drawable.notification_icon)
    .setContentTitle("Event tracker")
    .setContentText("Events received")
NotificationCompat.InboxStyle inboxStyle =
        new NotificationCompat.InboxStyle();
String[] events = new String[6];
// Sets a title for the Inbox in expanded layout
inboxStyle.setBigContentTitle("Event tracker details:");
...
// Moves events into the expanded layout
for (int i=0; i < events.length; i++) {

    inboxStyle.addLine(events[i]);
}
// Moves the expanded layout object into the notification object.
mBuilder.setStyle(inBoxStyle);
...
// Issue the notification here.

Google has good documentation for this: link

    
04.09.2016 / 00:23