在调用startForeground之后马上调用
stopForeground(true);
完整的就是这样:
将这两句代码放到onStartCommand中
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
//构建notification
startForeground(1, new NotificationCompat.Builder(this,
CHANNEL_ONE_ID).build());
stopForeground(true);
//最后调用父类的onStartCommand
return super.onStartCommand(intent, flags, startId);
}
最后
以上就是单身秋天最近收集整理的关于startForeground如何去掉通知栏的全部内容,更多相关startForeground如何去掉通知栏内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复