|
|
|
@ -23,10 +23,8 @@ import android.app.Notification;
|
|
|
|
|
import android.app.NotificationChannel;
|
|
|
|
|
import android.app.NotificationManager;
|
|
|
|
|
import android.content.Context;
|
|
|
|
|
import android.os.Build;
|
|
|
|
|
|
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
|
import androidx.annotation.RequiresApi;
|
|
|
|
|
import androidx.room.Entity;
|
|
|
|
|
import androidx.room.PrimaryKey;
|
|
|
|
|
|
|
|
|
@ -105,8 +103,8 @@ public class EntityAccount extends EntityOrder implements Serializable {
|
|
|
|
|
return "notification" + (account == 0 ? "" : "." + account);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequiresApi(api = Build.VERSION_CODES.O)
|
|
|
|
|
void createNotificationChannel(Context context) {
|
|
|
|
|
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
|
|
|
|
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
|
|
|
|
NotificationChannel channel = new NotificationChannel(
|
|
|
|
|
getNotificationChannelId(id), name,
|
|
|
|
@ -114,12 +112,14 @@ public class EntityAccount extends EntityOrder implements Serializable {
|
|
|
|
|
channel.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
|
|
|
|
|
nm.createNotificationChannel(channel);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequiresApi(api = Build.VERSION_CODES.O)
|
|
|
|
|
void deleteNotificationChannel(Context context) {
|
|
|
|
|
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
|
|
|
|
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
|
|
|
|
nm.deleteNotificationChannel(getNotificationChannelId(id));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
Long getSortId() {
|
|
|
|
|