C# Xamarin.Forms应用程序中的试用版

C# Xamarin.Forms应用程序中的试用版,c#,xamarin,xamarin.forms,C#,Xamarin,Xamarin.forms,我正在尝试为我的xamarin.forms应用程序实现试用版。实现这一目标的最佳方式是什么 我有一个想法,在Xamarin.Essentials.SecureStorage或Xamarin.Essentials.Preferences的帮助下在应用程序中存储一个唯一的ID,并将其与服务器上我的数据库中的数据进行比较,但问题是每次重新安装应用程序后,所有数据都会被删除 此外,我还想在每次应用程序启动期间访问Xamarin.essenties.DeviceInfo.Name并验证设备名称,但我不确定

我正在尝试为我的xamarin.forms应用程序实现试用版。实现这一目标的最佳方式是什么

我有一个想法,在Xamarin.Essentials.SecureStorage或Xamarin.Essentials.Preferences的帮助下在应用程序中存储一个唯一的ID,并将其与服务器上我的数据库中的数据进行比较,但问题是每次重新安装应用程序后,所有数据都会被删除

此外,我还想在每次应用程序启动期间访问Xamarin.essenties.DeviceInfo.Name并验证设备名称,但我不确定此属性是否在每次尝试期间返回唯一的设备名称

我是Xamarin的新手,所以我会感谢你的帮助。提前谢谢

        //using Xamarin.Essentials.Preferences
        var id = Preferences.Get("my_id", string.Empty);
        if (string.IsNullOrWhiteSpace(id))
        {
            id = System.Guid.NewGuid().ToString();
            Preferences.Set("my_id", id);
        }


        // using Xamarin.Essentials.SecureStorage
        private async void Save()
        {
          try
          {
            await SecureStorage.SetAsync("bla", "secret-oauth-token- 
         value");
          }
          catch (Exception ex)
          {
            // Possible that device doesn't support secure storage on 
         device.
          }
        }

        private async Task<string> Get()
        {
          try
          {
            return await SecureStorage.GetAsync("bla");
          }
          catch (Exception ex)
          {
            // Possible that device doesn't support secure storage on 
          device.
          }

          return null;
        }
//使用Xamarin.Essentials.Preferences
var id=Preferences.Get(“my_id”,string.Empty);
if(string.IsNullOrWhiteSpace(id))
{
id=System.Guid.NewGuid().ToString();
设置(“我的id”,id);
}
//使用Xamarin.Essentials.SecureStorage
私有异步void Save()
{
尝试
{
等待SecureStorage.SetAsync(“bla”,“秘密oauth令牌-
价值);;
}
捕获(例外情况除外)
{
//可能该设备不支持上的安全存储
装置。
}
}
私有异步任务Get()
{
尝试
{
return wait SecureStorage.GetAsync(“bla”);
}
捕获(例外情况除外)
{
//可能该设备不支持上的安全存储
装置。
}
返回null;
}

是否有某种登录方式?然后,您可以始终只在服务器上存储一个密钥,以确定是否已支付。并保存在设备上以供脱机使用。这样你就会知道它是否是付费版本。否则,在商店中单独发布lite版本