C# “Activity1.OnNewIntent(Content.Intent)”:未找到可重写的合适方法

C# “Activity1.OnNewIntent(Content.Intent)”:未找到可重写的合适方法,c#,xamarin.android,monogame,C#,Xamarin.android,Monogame,我在我的MonoGame Android项目中实现了App Center推送通知,一切似乎都正常,因为我在Android设备上收到了我从App Center帐户发送的通知。但在本教程中,他们提到,如果启动模式为SingleInstance,但代码不起作用,则应将此代码添加到Acitivity类中。我收到两条错误消息 当你有一个没有splashscreen的Android项目时,这段代码真的有必要吗?如果我在我的项目中添加一个splashscreen,会有什么不同吗 这段代码在做什么?如果有必要的

我在我的MonoGame Android项目中实现了App Center推送通知,一切似乎都正常,因为我在Android设备上收到了我从App Center帐户发送的通知。但在本教程中,他们提到,如果启动模式为SingleInstance,但代码不起作用,则应将此代码添加到Acitivity类中。我收到两条错误消息

当你有一个没有splashscreen的Android项目时,这段代码真的有必要吗?如果我在我的项目中添加一个splashscreen,会有什么不同吗

这段代码在做什么?如果有必要的话,我如何在单游戏Android项目中使用它

     protected override void OnNewIntent(Android.Content.Intent intent)
     {
         base.OnNewIntent(intent);
         Push.CheckLaunchedFromNotification(this, intent);
     }
命名空间中不存在类型或命名空间名称“Content” 是否缺少程序集引用

“Activity1.OnNewIntentContent.Intent”:未找到合适的方法 超越CS0115


您看到了编译器错误,因为项目中的命名空间以Android结尾,所以它试图查找NewApp.Android.Content.Intent,而不是Android.Content.Intent。您可以通过将名称空间更改为不以Android结尾来修复错误,也可以在引用全局Android名称空间时使用global::来修复错误:

protected override void OnNewIntent(global::Android.Content.Intent intent)
{
    base.OnNewIntent(intent);
    Push.CheckLaunchedFromNotification(this, intent);
}
protected override void OnNewIntent(global::Android.Content.Intent intent)
{
    base.OnNewIntent(intent);
    Push.CheckLaunchedFromNotification(this, intent);
}