Android Xamarin使用广播接收器接收传入的文本消息

Android Xamarin使用广播接收器接收传入的文本消息,android,broadcastreceiver,xamarin.forms,Android,Broadcastreceiver,Xamarin.forms,使用xamarin表单,我试图读取传入消息,并使用广播接收器类显示toast消息 下面是我的manifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto"> <uses-sdk android:minSdkVersio

使用xamarin表单,我试图读取传入消息,并使用广播接收器类显示toast消息

下面是我的manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"       android:installLocation="auto">
<uses-sdk android:minSdkVersion="22" android:targetSdkVersion="22" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.WRITE_SMS" />
<application android:label="DemoApp" android:debuggable="true">
</application>
</manifest>
接收级

[BroadcastReceiver(Enabled = true, Exported = true,Label = "SMS Receiver")]
[IntentFilter(new string[] { "android.provider.Telephony.SMS_RECEIVED"}, Priority = Int32.MaxValue)]
public class SmsReceiver : Android.Content.BroadcastReceiver
{
    public static readonly string INTENT_ACTION = "android.provider.Telephony.SMS_RECEIVED";

    public SmsReceiver()
    {
    }

    public override void OnReceive(Context context, Intent intent)
    {
        if (intent.Action == INTENT_ACTION)
        {
            if (ContextCompat.CheckSelfPermission(context,
                "android.permission.READ_SMS") != Permission.Denied)
            {
                Bundle bundle = intent.Extras;

                if (bundle != null)
                {
                    Java.Lang.Object[] pdus = (Java.Lang.Object[])bundle.Get("pdus");

                    if (pdus.Length == 0)
                    {
                        return;
                    }

                    SmsMessage[] msgs;
                    msgs = new SmsMessage[pdus.Length];

                    for (int i = 0; i < msgs.Length; i++)
                    {
                        msgs[i] = SmsMessage.CreateFromPdu((byte[])pdus[i], "3gpp");

                        Log.Info("SmsReceiver", "SMS Received from: " + msgs[i].OriginatingAddress);
                        Log.Info("SmsReceiver", "SMS Data: " + msgs[i].MessageBody.ToString());
                    }

                    Toast.MakeText(context.ApplicationContext, "SUCCESS",
                    ToastLength.Long).Show();

                    Log.Info("SmsReceiver", "SMS Received");
                }
            }
        }
    }
} 
但是上面的代码既不在log cat中显示info log消息,也不显示toast文本。
谁能帮我一下吗

要在Xamarin表单应用程序中显示祝酒词,你需要一个插件