zoukankan      html  css  js  c++  java
  • 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);
  • 相关阅读:
    Git的环境搭建
    AmazeUI HTML元素
    AmazeUI布局
    AmazeUI基本样式
    Bash简介
    Linux下拷贝目录和删除
    linux下的定时任务
    缓存
    隔离
    DEDECMS使用SQL命令批量替换语句
  • 原文地址:https://www.cnblogs.com/heml/p/3517382.html
Copyright © 2011-2022 走看看