Advertisement
Guest User

mindfart probably

a guest
Dec 18th, 2019
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.86 KB | None | 0 0
  1. protected override async void OnResume()
  2.         {
  3.          
  4.             try
  5.             {
  6.                 var License = Helpers.Settings.License;
  7.                 if (License != null)
  8.                 {
  9.                     var LicenseTrimmed = License.Replace("/", "").Replace("\\", "").Replace('"', ' ').Trim();
  10.                     var req = new RegistrationUpdate()
  11.                     {
  12.                         SerialKey = LicenseTrimmed
  13.                     };
  14.                     var stringc = new StringContent(JsonConvert.SerializeObject(req), Encoding.UTF8, "application/json");
  15.                     var res = await RestManager.Instance.ExecuteRest("getKey", stringc);
  16.                     if (res != null && res != "offline")
  17.                     {
  18.                         var resm = JsonConvert.DeserializeObject<RegistrationKey>(res);
  19.                         if (resm.RegToken == "" || resm.RegToken != CrossFirebasePushNotification.Current.Token)
  20.                         {
  21.                             var request = new RegistrationUpdate()
  22.                             {
  23.                                 RegToken = CrossFirebasePushNotification.Current.Token,
  24.                                 SerialKey = LicenseTrimmed
  25.                             };
  26.                             try
  27.                             {
  28.                                 var stringContent = new StringContent(JsonConvert.SerializeObject(request), Encoding.UTF8, "application/json");
  29.                                 await RestManager.Instance.ExecuteRest("SetPushtoken", stringContent);
  30.                             }
  31.                             catch
  32.                             {
  33.  
  34.                             }
  35.  
  36.                         }
  37.                     }
  38.                 }
  39.             }catch(Exception e)
  40.             {
  41.                 Crashes.TrackError(e);
  42.             }
  43.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement