Use ContextCompat.getSystemService() and the Context.getSystemService() extension function.

This commit is contained in:
Isira Seneviratne 2020-09-13 17:20:29 +05:30
parent f4620be859
commit 58b720b004
17 changed files with 61 additions and 43 deletions

View file

@ -234,8 +234,7 @@ public class App extends Application {
final NotificationChannel mChannel = new NotificationChannel(id, name, importance);
mChannel.setDescription(description);
final NotificationManager mNotificationManager =
(NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
final NotificationManager mNotificationManager = getSystemService(NotificationManager.class);
mNotificationManager.createNotificationChannel(mChannel);
setUpUpdateNotificationChannel(importance);
@ -260,7 +259,7 @@ public class App extends Application {
appUpdateChannel.setDescription(appUpdateDescription);
final NotificationManager appUpdateNotificationManager
= (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
= getSystemService(NotificationManager.class);
appUpdateNotificationManager.createNotificationChannel(appUpdateChannel);
}