Presentation is loading. Please wait.

Presentation is loading. Please wait.

6.4 Notification 通知栏.

Similar presentations


Presentation on theme: "6.4 Notification 通知栏."— Presentation transcript:

1 6.4 Notification 通知栏

2 定义 Notification作为一个时间触发性的交互提示接口,让我们获得消息的时候,在状态栏,锁屏界面显示相应的消息

3 创建 Notification.Builder builder = new Notification.Builder(this);

4 属性 builder.setSmallIcon(R.mipmap.ic_launcher); builder.setContentIntent(pendingIntent); builder.setAutoCancel(true); builder.setLargeIcon(BitmapFactory.decodeResource(getResou rces(),R.mipmap.ic_launcher)); builder.setContentText("内容") builder.setSubText("text");

5 跳转 Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(" //构造pendingdintent PendingIntent pendingIntent = PendingIntent.getActivities(this,0,intent,0);

6 发布 //通过NotificationManager来发出 NotificationManagernotificationManager=(NotificationManag er) getSystemService(NOTIFICATION_SERVICE); notificationManager.notify(0,builder.build());


Download ppt "6.4 Notification 通知栏."

Similar presentations


Ads by Google