I’m writing a C# MAUI app in .Net 8, and I’m having trouble adding a BroadcastReceiver because it apparently doesn’t exist in any of the packages I have. I haven’t been able to find the right package that would give me this.
Here are my current packages:
<ItemGroup>
<PackageReference Include="CommunityToolkit.Maui" Version="9.0.0" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.0.0" />
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Microsoft.Maui.Controls" Version="8.0.40" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.40" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
</ItemGroup>
Here’s the new class I’m trying to create.
namespace RemindMe.Services;
[BroadcastReceiver( Enabled = true )]
public class AlarmReceiver : BroadcastReceiver
{
}
When I pick “Quick Actions and Refactorings,” it doesn’t show me the option to use any namespace, which usually means I don’t have a package that contains the class.
Can someone tell me what package to use? I’ve looked all over and didn’t find one. I read that Mono.Android was what I needed, but I can’t find that on Nuget.
Thank you