下午研究問題還是,看到麥庫記事的同步問題,折騰了好久,他的通知出現以下就消失了,糾結了好久,難道要用線程做,不靠譜,找了一下午的api,想找點有用的,愣是沒找到。
NotificationManager notificationManager = (NotificationManager) context
.getSystemService(android.content.Context.NOTIFICATION_SERVICE);
Notification notification = new Notification(R.drawable.icon,
message,System.currentTimeMillis());
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, new Intent(), 0);
notification.setLatestEventInfo(context, null, null,
contentIntent);
notification.flags=Notification.FLAG_AUTO_CANCEL;
notificationManager.notify(123, notification);
notificationManager.cancel(123);
然後繼續鼓搗,在4點的時候,嘎嘎想出來了,我就試試吧,notify,然後再cancel,丫的竟然就是這個效果。感覺還不錯。嘿嘿。
notification
這個嘛,很多高手都詳解了,嘿嘿看會書