After switching to Api 34 in my Xamarin android project, I get the error ‘one of receiver_exported or receiver_not_exported should be specified when a receiver isn’t being registered exclusively for system broadcasts’.
IntentFilter filter = new IntentFilter(Intent.ActionRun);
if (Build.VERSION.SdkInt >= BuildVersionCodes.Tiramisu)
{
Context context = Android.App.Application.Context;
//IntentFilter filter = new IntentFilter(Intent.ActionRun);
ContextCompat.RegisterReceiver(this,consoleCmdReceiver, filter, ContextCompat.ReceiverExported);
}
else
{
RegisterReceiver(consoleCmdReceiver, filter);
}
if (Build.VERSION.SdkInt >= BuildVersionCodes.Tiramisu)
{
// Eğer API 33 ve sonrası ise `ToastNotification`'ı initialize etmeden önce gerekli flag'i ekleyin
//ToastNotification.Init(this ); // veya ReceiverNotExported
}
else
{
ToastNotification.Init(this);
}
It gives this error in the ToastNotification.Init(this); section: ‘one of receiver_exported or receiver_not_exported should be specified when a receiver isn’t being registered exclusively for system broadcasts’.