首页 > 其他 > 详细

Activity 通知

时间:2014-01-16 00:23:40      阅读:394      评论:0      收藏:0      [点我收藏+]
bubuko.com,布布扣
        //通知图标
        int icon = android.R.drawable.stat_notify_chat;
        //创建通知对象,icon通知图标,tickerText摘要,System.currentTimeMillis()通知时间
        Notification notification = new Notification(icon, tickerText, System.currentTimeMillis());
        Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:194949494"));
        //点击通知时的处理方法
        PendingIntent pendingIntent = PendingIntent.getActivity(this, 10, intent, 0);
        //为通知设置各项内容
        notification.setLatestEventInfo(this, title, content, pendingIntent);
        //设置通知的声音
        notification.defaults = Notification.DEFAULT_SOUND;
        //设置查看通知后,通知图标自动取消
        notification.flags = Notification.FLAG_AUTO_CANCEL;
        //构建通知管理器
        NotificationManager manager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
        //发送通知
        manager.notify(100, notification);
bubuko.com,布布扣

Activity 通知

原文:http://www.cnblogs.com/heml/p/3517382.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!