mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2025-01-23 09:27:31 +01:00
Improve notification
This commit is contained in:
parent
4d001f0089
commit
d5a5df2f0f
@ -4,6 +4,7 @@ import android.app.ActivityManager;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.app.Service;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
@ -11,6 +12,7 @@ import android.content.ContextWrapper;
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.PowerManager;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.RequiresApi;
|
||||
@ -71,11 +73,16 @@ public class ForegroundServiceContext extends ContextWrapper {
|
||||
channel.setShowBadge(false);
|
||||
channel.setLockscreenVisibility(0);
|
||||
channel.setVibrationPattern(new long[0]);
|
||||
Intent mIntent = new Intent();
|
||||
mIntent.setAction(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS);
|
||||
mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, mIntent, 0);
|
||||
context.getSystemService(NotificationManager.class).createNotificationChannel(channel);
|
||||
return new Notification.Builder(context, channel.getId())
|
||||
.setOngoing(true)
|
||||
.setContentIntent(pendingIntent)
|
||||
.setContentTitle("Running in background")
|
||||
.setContentText("Disable battery optimisations for microG to remove me")
|
||||
.setContentText("Tap me to disable battery optimisations for microG")
|
||||
.setSmallIcon(R.drawable.ic_foreground_notification)
|
||||
.build();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user