Activity 通知

        //通知图标
        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);

 

posted @ 2014-01-13 14:22  天之涯0204  阅读(361)  评论(0编辑  收藏  举报