я пытаюсь создать уведомление с целевым API 26 и минимальным API 19. Я не могу получить конструктор NotificationCompat.Builder, который принимает идентификатор канала в качестве второго аргумента.
Пока это мой класс уведомлений. В самом низу я хочу получить построитель уведомлений.
public class NotificationHelper extends ContextWrapper {
private NotificationManager notificationManager;
public NotificationHelper(Context base) {
super(base);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
createChannel();
}
}
@TargetApi(Build.VERSION_CODES.O)
public void createChannel() {
NotificationChannel channel1 = new NotificationChannel("channel1", "Channel one", NotificationManager.IMPORTANCE_DEFAULT);
channel1.enableLights(true);
channel1.enableVibration(true);
channel1.setLightColor(R.color.colorPrimary);
channel1.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
getManager().createNotificationChannel(channel1);
}
public NotificationManager getManager() {
if (notificationManager == null) {
notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
}
return notificationManager;
}
public NotificationCompat.Builder() {
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(getApplicationContext(), "channel1");
}
}
build.gradle
файл, пожалуйста. - person Giorgio Antonioli   schedule 04.10.2017