This commit is contained in:
Oizaro 2020-09-07 16:22:24 +02:00
parent a0ffb9846b
commit d3a6ffb057
1 changed files with 3 additions and 9 deletions

View File

@ -73,18 +73,12 @@ public class ForegroundServiceContext extends ContextWrapper {
mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, mIntent, 0);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context, "foreground-service")
return new NotificationCompat.Builder(context, "foreground-service")
.setOngoing(true)
.setContentIntent(pendingIntent)
.setContentTitle(context.getResources().getString(R.string.notification_service_title))
.setContentText(context.getResources().getString(R.string.notification_service_content))
.setSmallIcon(R.drawable.ic_foreground_notification);
NotificationManager notificationManager =
(NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE);
notificationManager.notify(0, notificationBuilder.build());
return null;
.setSmallIcon(R.drawable.ic_foreground_notification)
.build();
}
}