//传入notifycation对象的作用是,当将服务设为前台服务后,会在状态栏显示一条通知
public void showCXBRunning() {
NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Notification builder = new Notification.Builder(this).setTicker("").setSmallIcon(R.drawable.ic_launcher).build();
//id 不能为0
startForeground(1, builder);
}
https://blog.csdn.net/sinat_35159441/article/details/68925922
https://blog.csdn.net/marswin89/article/details/50890708