0
0
Fork 0
mirror of https://github.com/YTVanced/VancedMicroG synced 2024-12-03 16:27:26 +00:00

Workaround for Android 8.0 NotificationChannel bug

Fixes #1312
This commit is contained in:
Marvin W 2020-12-14 10:04:39 +01:00
parent 847e823d64
commit 3db548187d
No known key found for this signature in database
GPG key ID: 072E9235DB996F2A
2 changed files with 1 additions and 14 deletions

View file

@ -50,7 +50,7 @@ public class ForegroundServiceContext extends ContextWrapper {
NotificationChannel channel = new NotificationChannel("foreground-service", "Foreground Service", NotificationManager.IMPORTANCE_NONE);
channel.setLockscreenVisibility(Notification.VISIBILITY_SECRET);
channel.setShowBadge(false);
channel.setVibrationPattern(new long[0]);
channel.setVibrationPattern(new long[] {0});
context.getSystemService(NotificationManager.class).createNotificationChannel(channel);
return new Notification.Builder(context, channel.getId())
.setOngoing(true)

View file

@ -329,19 +329,6 @@ public class McsService extends Service implements Handler.Callback {
return START_REDELIVER_INTENT;
}
@RequiresApi(api = Build.VERSION_CODES.O)
private Notification buildForegroundNotification() {
NotificationChannel channel = new NotificationChannel("foreground-service", "Foreground Service", 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")
.setSmallIcon(android.R.drawable.stat_notify_sync)
.build();
}
private void handleSendMessage(Intent intent) {
String messageId = intent.getStringExtra(EXTRA_MESSAGE_ID);
String collapseKey = intent.getStringExtra(EXTRA_COLLAPSE_KEY);