diff --git a/app/src/main/java/com/amaze/filemanager/ui/notifications/FtpNotification.java b/app/src/main/java/com/amaze/filemanager/ui/notifications/FtpNotification.java index defb81ff26..7117f551d5 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/notifications/FtpNotification.java +++ b/app/src/main/java/com/amaze/filemanager/ui/notifications/FtpNotification.java @@ -31,7 +31,6 @@ import com.amaze.filemanager.utils.NetworkUtil; import android.app.Notification; -import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; @@ -39,6 +38,7 @@ import androidx.annotation.StringRes; import androidx.core.app.NotificationCompat; +import androidx.core.app.NotificationManagerCompat; import androidx.preference.PreferenceManager; /** @@ -96,9 +96,7 @@ public static Notification startNotification(Context context, boolean noStopButt } public static void updateNotification(Context context, boolean noStopButton) { - String notificationService = Context.NOTIFICATION_SERVICE; - NotificationManager notificationManager = - (NotificationManager) context.getSystemService(notificationService); + NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context); SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context); int port = sharedPreferences.getInt(FtpService.PORT_PREFERENCE_KEY, FtpService.DEFAULT_PORT); @@ -129,8 +127,6 @@ public static void updateNotification(Context context, boolean noStopButton) { } private static void removeNotification(Context context) { - String ns = Context.NOTIFICATION_SERVICE; - NotificationManager nm = (NotificationManager) context.getSystemService(ns); - nm.cancelAll(); + NotificationManagerCompat.from(context).cancelAll(); } }