1

I want to implement resume and pause function running music in the background from notification bar. In my code I am using radio play from url downloaded from server. And then play audio in background. But i want to add functionality to play and pause function without open application. Thank you.

Das
  • 141
  • 13

1 Answers1

1

already asked:

Handling buttons inside android notifications

Adding onClick Action To Button In Notification

doesn't have enough reputations to add these links as a comment

Yazazzello
  • 6,053
  • 1
  • 19
  • 21
  • it's the only way to work with clicks on notification views. You create PendingIntent and assign this intent to remoteView like this: `notificationView.setOnClickPendingIntent(R.id.buttonswitch, pendingSwitchIntent);` – Yazazzello Aug 31 '15 at 12:52
  • yaeh i do. but i want both . open activity and also start stop funcation like our phone music player. understand? – Das Aug 31 '15 at 12:54
  • no problems, just add another pending intent to parent view – Yazazzello Aug 31 '15 at 12:57
  • like. just for an example – Das Aug 31 '15 at 12:59
  • I was wrong, it's not necessary to add pendingintent to parent view, simply setContentIntent for notification builder and you will start activity clicking the whole notification. About child views: I've tried the first example and have no succes until register Broadcast receiver in Manifest. Does it help you, @Das ? – Yazazzello Aug 31 '15 at 14:16
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/88382/discussion-between-yazazzello-and-das). – Yazazzello Aug 31 '15 at 14:17