zoukankan      html  css  js  c++  java
  • PendingIntent 显示通知

    安卓显示通知

    PendingIntent pendingIntent=PendingIntent.getActivity(Media.this,0,
                            new Intent(Media.this,Media.class),0);
    
                    NotificationManager manager= (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    
                    Notification notification=new Notification.Builder(Media.this)
                  .setSmallIcon(R.drawable.icon)  //不设置会不显示通知 .setTicker(
    "Ticker Text"+"您有新消息,请注意查收") .setContentTitle("通知标题") .setContentText("通知内容") .setContentIntent(pendingIntent) .setNumber(1)//在TextView的右方显示的数字,可放大图片看,在最右侧。 // 这个number同时也起到一个序列号的左右,如果多个触发多个通知(同一ID),可以指定显示哪一个 .build(); //任然可以使用 不用管 //当用户点击通知时 通知清除 notification.flags=Notification.FLAG_AUTO_CANCEL; //通过通知管理器发起通知 manager.notify(1,notification);
  • 相关阅读:
    171-滑动窗口问题
    170-133. 克隆图
    169-150. 逆波兰表达式求值
    windows相对路径设置与取消小工具[提效]
    Sword 38
    Sword 33
    Sword 28
    Sword 26
    Sword 12
    Sword 07
  • 原文地址:https://www.cnblogs.com/lljh/p/6804010.html
Copyright © 2011-2022 走看看