NotificationChannel.SetSound don't work on Xiaomi HyperOS 1.0.24.0
- Dominant language
- C#
- Stars
- 3.7k
- Forks
- 1.5k
- PR merge metrics
- No merged PRs in 30d
Description
My phone is Xiaomi 21091116C Android 13.0 - API 33
Xiaomi HyperOS 1.0.24.0
I have set the SoundUri and the sound is none in appinfo => notifications => defaultChannel(Notification) => sound.
But in the Andriod Emulator it's work.
```
void CreateNotificationChannel()
{
const string channelId = "notification";
const string channelName = "Notification";
const string channelDescription = "Default Notification Sound";
// Create the notification channel, but only on API 26+.
if (Build.VERSION.SdkInt >= BuildVersionCodes.O)
{
var channelNameJava = new Java.Lang.String(channelName);
var channel = new NotificationChannel(channelId, channelNameJava, NotificationImportance.Default)
{
Description = channelDescription
};
var defaultSoundUri = RingtoneManager.GetDefaultUri(RingtoneType.Notification);
var audioAttributes = new AudioAttributes.Builder()
.SetUsage(AudioUsageKind.Notification)
.SetContentType(AudioContentType.Sonification)
.Build();
channel.SetSound(defaultSoundUri, audioAttributes);
channel.EnableVibration(true);
channel.EnableLights(false);
// Register the channel
var manager = Platform.AppContext.GetSystemService(Context.NotificationService) as NotificationManager;
manager.CreateNotificationChannel(channel);
channelInitialized = true;
}
}
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.