MIUI sound workaround for sending

pull/194/head
M66B 4 years ago
parent e7be9dd581
commit ddb23099b5

@ -198,6 +198,9 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
} }
NotificationCompat.Builder getNotificationService() { NotificationCompat.Builder getNotificationService() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
boolean alert_once = prefs.getBoolean("alert_once", true);
NotificationCompat.Builder builder = NotificationCompat.Builder builder =
new NotificationCompat.Builder(this, "send") new NotificationCompat.Builder(this, "send")
.setSmallIcon(R.drawable.baseline_send_white_24) .setSmallIcon(R.drawable.baseline_send_white_24)
@ -205,7 +208,7 @@ public class ServiceSend extends ServiceBase implements SharedPreferences.OnShar
.setContentIntent(getPendingIntent(this)) .setContentIntent(getPendingIntent(this))
.setAutoCancel(false) .setAutoCancel(false)
.setShowWhen(true) .setShowWhen(true)
.setOnlyAlertOnce(true) .setOnlyAlertOnce(alert_once)
.setDefaults(0) // disable sound on pre Android 8 .setDefaults(0) // disable sound on pre Android 8
.setLocalOnly(true) .setLocalOnly(true)
.setPriority(NotificationCompat.PRIORITY_MIN) .setPriority(NotificationCompat.PRIORITY_MIN)

Loading…
Cancel
Save