在Xamarin.Android本机级别的Firebase消息服务中使用Xamarin.Forms.Applicatio



我正在做一个Xamarin.Forms项目。并在Xamarin.Android Native Level中使用Firebase云消息

我在Xamarin.Forms.Application.Current.Properties词典中保存了登录详细信息。

之后,我在com.google.firebase.MESSAGING_EVENT服务的OnMessageReceived方法中使用了相同的Xamarin.Forms.Application.Current.Properties

现在,当应用程序处于前景或背景时,可以访问Xamarin.Forms.Application.Current.Properties字典(但未被杀死(。但是,当通过向左/向右滑动应用程序来关闭/杀死应用程序时,无法访问Xamarin.Forms.Application.Current.Properties字典。

我试图了解如何将Xamarin.Forms.Application.Current.Properties词典保存在Xamarin.AndroidSharedPreferences中,因为即使应用程序被杀死,它也可以访问,但无法成功。

那么,我能做到这一点吗?如果是,那么如何

您可以使用Xamarin软件包,它有一个API用于在SharedPreferences中保存数据。

你可以在这里看到所有的例子。

最新更新