- Log.e(TAG, "create notification");
- //使用兼容版本
- NotificationCompat.Builder builder=new NotificationCompat.Builder(this);
- //设置状态栏的通知图标
- builder.setSmallIcon(R.mipmap.ic_launcher);
- //设置通知栏横条的图标
- builder.setLargeIcon(BitmapFactory.decodeResource(getResources(),R.drawable.ic_launcher_background));
- //禁止用户点击删除按钮删除
- builder.setAutoCancel(false);
- //禁止滑动删除
- builder.setOngoing(true);
- //右上角的时间显示
- builder.setShowWhen(true);
- //设置通知栏的标题内容
- builder.setContentTitle("Rtmp Foreground Service!!!");
- //创建通知
- Notification notification = builder.build();
- //设置为前台服务
- startForeground(NOTIFICATION_DOWNLOAD_PROGRESS_ID,notification);
+ gLogger.error("createNotification");
+ NotificationCompat.Builder builder=new NotificationCompat.Builder(this); //使用兼容版本
+ builder.setSmallIcon(R.mipmap.ic_launcher); //设置状态栏的通知图标
+ builder.setLargeIcon(BitmapFactory.decodeResource(getResources(),R.drawable.ic_launcher_background)); //设置通知栏横条的图标
+ builder.setAutoCancel(false); //禁止用户点击删除按钮删除
+ builder.setOngoing(true); //禁止滑动删除
+ builder.setShowWhen(true); //右上角的时间显示
+ builder.setContentTitle("Rtmp Foreground Service!!!"); //设置通知栏的标题内容
+ Notification notification = builder.build(); //创建通知
+ startForeground(NOTIFICATION_DOWNLOAD_PROGRESS_ID,notification); //设置为前台服务