美文网首页
前台 service

前台 service

作者: WangRain1 | 来源:发表于2020-10-23 14:25 被阅读0次

private void startForeground() {

String channelId ="com.thundersoft.bugreport";

    String channelName ="BugReport";

    NotificationChannel notificationChannel =null;

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {

notificationChannel =new NotificationChannel(channelId,

                channelName, NotificationManager.IMPORTANCE_DEFAULT);

        NotificationManager manager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

        manager.createNotificationChannel(notificationChannel);

        startForeground(1, new Notification.Builder(this, channelId).build());

    }

}

相关文章

网友评论

      本文标题:前台 service

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