This commit is contained in:
Oizaro 2020-08-23 22:45:39 +02:00
parent 8703fb3138
commit daa23d87bf
2 changed files with 6 additions and 5 deletions

View File

@ -70,7 +70,7 @@ public class ForegroundServiceContext extends ContextWrapper {
@RequiresApi(api = Build.VERSION_CODES.O)
private static Notification buildForegroundNotification(Context context) {
NotificationChannel channel = new NotificationChannel("foreground-service", Resources.getSystem().getString(R.string.notification_service_name), NotificationManager.IMPORTANCE_MIN);
NotificationChannel channel = new NotificationChannel("foreground-service", context.getResources().getString(R.string.notification_service_name), NotificationManager.IMPORTANCE_MIN);
channel.setShowBadge(false);
channel.setLockscreenVisibility(0);
channel.setVibrationPattern(new long[0]);
@ -82,8 +82,8 @@ public class ForegroundServiceContext extends ContextWrapper {
return new Notification.Builder(context, channel.getId())
.setOngoing(true)
.setContentIntent(pendingIntent)
.setContentTitle(Resources.getSystem().getString(R.string.notification_service_title))
.setContentText(Resources.getSystem().getString(R.string.notification_service_content))
.setContentTitle(context.getResources().getString(R.string.notification_service_title))
.setContentText(context.getResources().getString(R.string.notification_service_content))
.setSmallIcon(R.drawable.ic_foreground_notification)
.build();
}

View File

@ -43,6 +43,7 @@ import android.util.Log;
import androidx.annotation.RequiresApi;
import androidx.legacy.content.WakefulBroadcastReceiver;
import com.mgoogle.android.gms.R;
import com.squareup.wire.Message;
import org.microg.gms.checkin.LastCheckinInfo;
@ -320,13 +321,13 @@ public class McsService extends Service implements Handler.Callback {
@RequiresApi(api = Build.VERSION_CODES.O)
private Notification buildForegroundNotification() {
NotificationChannel channel = new NotificationChannel("foreground-service", "Foreground Service", NotificationManager.IMPORTANCE_LOW);
NotificationChannel channel = new NotificationChannel("foreground-service", getString(R.string.notification_service_name), NotificationManager.IMPORTANCE_LOW);
channel.setLockscreenVisibility(Notification.VISIBILITY_SECRET);
channel.setShowBadge(false);
getSystemService(NotificationManager.class).createNotificationChannel(channel);
return new Notification.Builder(this, channel.getId())
.setOngoing(true)
.setContentTitle("Running in background")
.setContentTitle(this.getResources().getString(R.string.notification_service_title))
.setSmallIcon(android.R.drawable.stat_notify_sync)
.build();
}