0701-APP-Notification-IncommingMessage
来源:互联网 发布:支付宝没开网络被盗刷? 编辑:程序博客网 时间:2024/06/03 19:59
1.Notification的生成
// look up the notification manager service NotificationManager nm = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); // The details of our fake message CharSequence from = "Joe"; CharSequence message = "kthx. meet u for dinner. cul8r"; // The PendingIntent to launch our activity if the user selects this notification PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, IncomingMessageView.class), 0); // The ticker text, this uses a formatted string so our message could be localized String tickerText = getString(R.string.imcoming_message_ticker_text, message); // construct the Notification object. Notification notif = new Notification(R.drawable.stat_sample, tickerText, System.currentTimeMillis()); // Set the info for the views that show in the notification panel. notif.setLatestEventInfo(this, from, message, contentIntent); // after a 100ms delay, vibrate for 250ms, pause for 100 ms and // then vibrate for 500ms. notif.vibrate = new long[] { 100, 250, 100, 500}; // Note that we use R.layout.incoming_message_panel as the ID for // the notification. It could be any integer you want, but we use // the convention of using a resource id for a string related to // the notification. It will always be a unique number within your // application. nm.notify(R.string.imcoming_message_ticker_text, notif);
注释:IncomingMessageView只是简单的Activity在这清楚notification
// look up the notification manager service NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); // cancel the notification that we started in IncomingMessage nm.cancel(R.string.imcoming_message_ticker_text);
0 0
- 0701-APP-Notification-IncommingMessage
- 0702-APP-notification-service
- android2.--App/Notification 以及android.app.Notification$Builder.setProgress问题
- 0703-APP-Notification-statue-bar
- android app notification的用法
- 在Metro App中显示Toast notification
- IOS Push Notification 和App ID
- Android Studio App设置Notification通知
- android notification通知栏方式更新APP
- app Remote Notification远程消息推送处理
- Notification
- Notification
- Notification
- Notification
- notification
- Notification
- Notification
- Notification
- 2、Android第一个小程序
- openoffice二三事
- POJ 2262 Goldbach's Conjecture
- Why are some programming languages faster than others?
- ac-ap环境搭建
- 0701-APP-Notification-IncommingMessage
- i2s协议
- IOS 后台线程操作UIActivityIndicatorView动画被检测出内存泄露
- ios客户端开源的项目
- Tomcat 并发优化
- POJ 3278 Catch That Cow
- js prototype概述
- HDU-1142 A Walk Through the Forest
- IA32中栈帧结构图