Comment puis-je afficher une notification de barre d'état avec MonoDroid en utilisant C#?Afficher la notification de la barre d'état avec MonoDroid C#
Quelqu'un peut-il me donner un exemple?
Merci.
Comment puis-je afficher une notification de barre d'état avec MonoDroid en utilisant C#?Afficher la notification de la barre d'état avec MonoDroid C#
Quelqu'un peut-il me donner un exemple?
Merci.
Vous voulez utiliser Android.App.Notification et Android.App.NotificationManager, par exemple de LocalService.ShowNotification():
// within some Android.Content.Context subclass (Activity, Service, etc.)
void ShowNotification()
{
IEnumerable<char> text = GetText (Resource.String.local_service_started);
var notification = new Notification (Resource.Drawable.stat_sample,
text,
System.Environment.TickCount);
PendingIntent contentIntent = PendingIntent.GetActivity (this, 0,
new Intent (this, typeof (LocalServiceActivities.Controller)),
0);
notification.SetLatestEventInfo (this,
GetText ([email protected]_service_label),
text,
contentIntent);
var nm = (NotificationManager) GetSystemService (NotificationService);
nm.Notify (Resource.String.local_service_started, notification);
}
Vous pouvez voir lien ci-dessous, et comme la page pour en savoir plus: https://www.facebook.com/pages/M%C3%A3-Ngu%E1%BB%93n/371039113001844
Essayez PushSharp: https://github.com/Redth/PushSharp
Cela a très bien fonctionné pour moi.
Veuillez ajouter du code ici pour des exemples. – Amit