2

如何使用 C# 显示带有 MonoDroid 的状态栏通知?

有人可以给我一个例子吗?

谢谢。

4

3 回答 3

5

您想使用Android.App.NotificationAndroid.App.NotificationManager,例如来自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 (Resource.@string.local_service_label), 
            text, 
            contentIntent);
    var nm = (NotificationManager) GetSystemService (NotificationService);
    nm.Notify (Resource.String.local_service_started, notification);
}
于 2011-01-29T23:47:58.600 回答
0

您可以看到下面的链接,并喜欢页面以查看更多信息: https ://www.facebook.com/pages/M%C3%A3-Ngu%E1%BB%93n/371039113001844

于 2013-06-05T02:28:26.523 回答
0

尝试 PushSharp: https ://github.com/Redth/PushSharp

它对我很有用。

于 2013-06-05T10:45:06.367 回答