Use silent notification at the default priority

This commit is contained in:
artdeell 2022-11-13 15:22:50 +03:00 committed by ArtDev
parent 9cebcd2cf4
commit 0252ab1d96
3 changed files with 5 additions and 3 deletions

View File

@ -193,7 +193,7 @@ public final class Tools {
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return;
NotificationChannel channel = new NotificationChannel(
context.getString(R.string.notif_channel_id),
context.getString(R.string.notif_channel_name), NotificationManager.IMPORTANCE_HIGH);
context.getString(R.string.notif_channel_name), NotificationManager.IMPORTANCE_DEFAULT);
NotificationManagerCompat manager = NotificationManagerCompat.from(context);
manager.createNotificationChannel(channel);
}

View File

@ -49,7 +49,8 @@ public class GameService extends Service {
.setContentTitle(getString(R.string.lazy_service_default_title))
.setContentText(getString(R.string.notification_game_runs))
.addAction(android.R.drawable.ic_menu_close_clear_cancel, getString(R.string.notification_terminate), pendingKillIntent)
.setSmallIcon(R.mipmap.ic_launcher_round);
.setSmallIcon(R.mipmap.ic_launcher_round)
.setNotificationSilent();
startForeground(2, notificationBuilder.build());
return START_NOT_STICKY; // non-sticky so android wont try restarting the game after the user uses the "Quit" button
}

View File

@ -49,7 +49,8 @@ public class ProgressService extends Service implements TaskCountListener {
mNotificationBuilder = new NotificationCompat.Builder(this, "channel_id")
.setContentTitle(getString(R.string.lazy_service_default_title))
.addAction(android.R.drawable.ic_menu_close_clear_cancel, getString(R.string.notification_terminate), pendingKillIntent)
.setSmallIcon(R.mipmap.ic_launcher_round);
.setSmallIcon(R.mipmap.ic_launcher_round)
.setNotificationSilent();
}
@Override