[Java] Notification →→→→→进入此内容的聊天室

来自 , 2021-01-26, 写在 Java, 查看 117 次.
URL http://www.code666.cn/view/64223ccf
  1. manager = (NotificationManager) this
  2.                                 .getSystemService(Context.NOTIFICATION_SERVICE);
  3.                 notification = new Notification();
  4.                 notification.icon = R.drawable.app_icon;
  5.                 notification.tickerText = "天天动听,美好音质。";
  6.                 notification.flags = Notification.FLAG_NO_CLEAR;
  7.                  rm=new RemoteViews(this
  8.                                 .getPackageName(), R.layout.notification);
  9.                
  10.                
  11.                 Intent pre=new Intent();
  12.                 pre.setAction("com.exmple.ttplayer.ntf_pre");
  13.                 //pre.putExtra("ntf_pre", 2);
  14.                 PendingIntent prePen=PendingIntent.getBroadcast(this, 0, pre, 0);
  15.                 rm.setOnClickPendingIntent(R.id.ntf_pre, prePen);
  16.                
  17.                 Intent play=new Intent();
  18.                 play.setAction("com.exmple.ttplayer.ntf_play");
  19.                 //play.putExtra("ntf_play", 1);
  20.                 PendingIntent playPen=PendingIntent.getBroadcast(this, 0, play, 0);
  21.                 rm.setOnClickPendingIntent(R.id.ntf_ply, playPen);
  22.                 Intent next=new Intent();
  23.                 next.setAction("com.exmple.ttplayer.ntf_next");
  24.                 //next.putExtra("ntf_next", 3);
  25.                 PendingIntent nextPen=PendingIntent.getBroadcast(this, 0, next, 0);
  26.                 rm.setOnClickPendingIntent(R.id.ntf_next, nextPen);
  27.                
  28.                
  29.                 notification.contentView = rm;
  30.                 it = new Intent(First.this, TabHo.class);
  31.                 PendingIntent pintent = PendingIntent.getActivity(this, 1, it, 1);
  32.                 notification.contentIntent = pintent;
  33.                 manager.notify(1, notification);

回复 "Notification"

这儿你可以回复上面这条便签

captcha