diff --git a/android/src/main/kotlin/com/dexloop/flutter_alarm_notification/Utils.kt b/android/src/main/kotlin/com/dexloop/flutter_alarm_notification/Utils.kt index 27d1849..c841144 100644 --- a/android/src/main/kotlin/com/dexloop/flutter_alarm_notification/Utils.kt +++ b/android/src/main/kotlin/com/dexloop/flutter_alarm_notification/Utils.kt @@ -35,6 +35,7 @@ import android.content.pm.PackageManager import android.graphics.Color import android.graphics.drawable.BitmapDrawable import android.media.AudioAttributes +import android.media.AudioManager import android.media.RingtoneManager import android.net.Uri import android.os.Build @@ -64,7 +65,7 @@ fun Context.showNotification( longArrayOf( 0, 100, 200, 300 ) - ).setSilent(false).setOnlyAlertOnce(true) + ).setSilent(false) .setFullScreenIntent( pendingIntent( requestCode = 35, @@ -132,10 +133,12 @@ private fun NotificationManager.buildChannel( } channel.enableLights(true) + val notificationSound: Uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM) val audioAttributes = AudioAttributes.Builder() .setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION) .setUsage(AudioAttributes.USAGE_ALARM) + .setLegacyStreamType(AudioManager.STREAM_ALARM) .build() channel.setSound(notificationSound, audioAttributes) diff --git a/lib/flutter_alarm_notification.dart b/lib/flutter_alarm_notification.dart index 257635e..71355f0 100644 --- a/lib/flutter_alarm_notification.dart +++ b/lib/flutter_alarm_notification.dart @@ -34,7 +34,9 @@ class FlutterAlarmNotification { static registerPort({NotificationActionCallback? callback}) { IsolateNameServer.registerPortWithName( - _uiReceivePort.sendPort, _buttonActionIsolateName); + _uiReceivePort.sendPort, + _buttonActionIsolateName, + ); if (callback != null) { listenable.listen((message) { @@ -55,7 +57,7 @@ class FlutterAlarmNotification { /// Set a recursive alarms that sets of at a particular time /// and repeats at an interval /// To set configurations for this alram use [alarmConfig] - /// [nottificationBuilder] accepts fields that's pertaining to the notification + /// [notificationBuilder] accepts fields that's pertaining to the notification /// if you need to pass data to the intent set [intentBuilder] parameter . static Future registerRepeatingAlarm({ required AlarmConfig alarmConfig,