Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update StrideActivity.cs #2351

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions sources/engine/Stride.Games/Starter/StrideActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,15 @@ protected override void OnRun()
{
// set up a listener to the android ringer mode (Normal/Silent/Vibrate)
ringerModeIntentReceiver = new RingerModeIntentReceiver((AudioManager)GetSystemService(AudioService));
RegisterReceiver(ringerModeIntentReceiver, new IntentFilter(AudioManager.RingerModeChangedAction));
if (OperatingSystem.IsAndroidVersionAtLeast(34))
{
RegisterReceiver(ringerModeIntentReceiver, new IntentFilter(AudioManager.RingerModeChangedAction), ReceiverFlags.Exported);
}
else
{
RegisterReceiver(ringerModeIntentReceiver, new IntentFilter(AudioManager.RingerModeChangedAction));
}


// Set the android global context
if (PlatformAndroid.Context == null)
Expand Down Expand Up @@ -70,7 +78,14 @@ protected override void OnResume()
{
base.OnResume();

RegisterReceiver(ringerModeIntentReceiver, new IntentFilter(AudioManager.RingerModeChangedAction));
if (OperatingSystem.IsAndroidVersionAtLeast(34))
{
RegisterReceiver(ringerModeIntentReceiver, new IntentFilter(AudioManager.RingerModeChangedAction), ReceiverFlags.Exported);
}
else
{
RegisterReceiver(ringerModeIntentReceiver, new IntentFilter(AudioManager.RingerModeChangedAction));
}
}

/// <summary>
Expand Down