美文网首页
安卓通知栏

安卓通知栏

作者: 水固态中 | 来源:发表于2018-01-21 18:22 被阅读0次

Intent intent=new Intent(this,NotificationActivity.class);

PendingIntent pi=PendingIntent.getActivity(this,0,intent,0);

NotificationManager manager=(NotificationManager) getSystemService(NOTIFICATION_SERVICE);

Notification notification=new NotificationCompat.Builder(this).

setContentTitle("通知标题").setContentText("内容").

setWhen(System.currentTimeMillis()).

setSmallIcon(R.drawable.ic_launcher).

setLargeIcon(BitmapFactory.decodeResource(getResources(),R.drawable.ic_launcher)).

setContentIntent(pi).

setAutoCancel(true).build();

manager.notify(1,notification);

待续

相关文章

网友评论

      本文标题:安卓通知栏

      本文链接:https://www.haomeiwen.com/subject/zpdqaxtx.html