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

View File

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