Android(安卓)Notification 显示后消失
16lz
2021-01-26
下午研究问题还是,看到麦库记事的同步问题,折腾了好久,他的通知出现以下就消失了,纠结了好久,难道要用线程做,不靠谱,找了一下午的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这个嘛,很多高手都详解了,嘿嘿看会书
更多相关文章
- Android(安卓)Studio 下自动注释(自定义作者,类作用等)
- 五月小结
- Android日记之2012\01\16
- android锁屏
- Bluetooth 4.0 mio alpha watch 心率监护应用 2
- 处女apk纠结过的技术点
- Android(安卓)sharesdk 集成Google登陆,报错Success,{"isSigin":"f
- 为什么移动端跨平台开发不靠谱?
- android一个纠结的VFY错误