package com.dragonssh.xhttpdemo.core;

import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.content.Context;
import android.os.Build;

/** Creates the quiet foreground-service channel used by the sample. */
public final class XHttpSshCore {
    private XHttpSshCore() {}

    public static void init(Context context) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return;
        NotificationManager manager = context.getSystemService(NotificationManager.class);
        if (manager == null) return;
        NotificationChannel channel = new NotificationChannel(
                XHttpSshService.NOTIFICATION_CHANNEL_ID,
                context.getString(R.string.channel_name_background),
                NotificationManager.IMPORTANCE_LOW);
        channel.setDescription(context.getString(R.string.channel_description_background));
        channel.setSound(null, null);
        channel.enableVibration(false);
        manager.createNotificationChannel(channel);
    }
}
