如何解决将Azure Notifications Hub添加到Xamarin Forms Webview移动Blazor绑定 其他信息如果需要
背景和说明
我正在关注Microsoft的this tutorial,以将通知添加到我的移动应用中。我正在构建的应用只是Mobile Blazor绑定中的一个Webview。
MyApp / Main.razor:
<ContentView>
<StackLayout>
<BlazorWebView ContentRoot="WebUI/wwwroot" VerticalOptions="LayoutOptions.FillAndExpand">
<MyApp.WebUI.App />
</BlazorWebView>
</StackLayout>
</ContentView>
在Firebase和Azure的通知中心中设置项目后,我正在实现Xamarin Forms功能,并且出现错误。
Here in this code snippet会覆盖onNewIntent:
protected override void OnNewIntent(Intent intent)
{
if (intent.Extras != null)
{
var message = intent.GetStringExtra("message");
(App.Current.MainPage as MainPage)?.AddMessage(message);
}
base.OnNewIntent(intent);
}
问题
MainPage
中的 (App.Current.MainPage as MainPage)?.AddMessage(message);
是示例Xamarin Forms Project中共享客户端项目中xaml文件的名称。但是在我的项目中,将MainPage
更改为MyApp.Main
后,出现此错误:
Cannot convert type 'Xamarin.Forms.Page' to 'MyApp.Main' via a reference conversion,boxing conversion,unboxing conversion,wrapping conversion,or null type conversion
我该如何解决?我的理解是,我应该指向我的主页,因此在单击通知后,我应该导航到我的主页。
我可以在WebView中使用通知吗?
其他信息(如果需要)
项目结构:
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。