Reputation: 343
I'm trying to create a simple music player in Xamarin.Android. In my app I'm creating a started service for background streaming, and I want to create a notification for the user to be abel to interact with the service. Something like this:
I read about notification in Xamarin.Android here, but they say nothing about adding buttons and other ui elements. So my question is how do I design a notification?
Upvotes: 0
Views: 1116
Reputation: 484
Look Android documentation about custom notification layouts: https://developer.android.com/guide/topics/ui/notifiers/notifications.html#CustomNotification
Create an XML layout for the notification in a separate file. You can use any file name you wish, but you must use the extension .xml
In your app, use RemoteViews methods to define your notification's icons and text. Put this RemoteViews object into your NotificationCompat.Builder by calling setContent(). Avoid setting a background Drawable on your RemoteViews object, because your text color may become unreadable.
Upvotes: 1