Exemplo n.º 1
0
 private static void Initialize()
 {
     Microsoft.AppCenter.Utils.ApplicationLifecycleHelper.Instance.ApplicationResuming += (s, e) =>
     {
         WSAApplication.InvokeOnAppThread(new UnityEngine.WSA.AppCallbackItem(() =>
         {
             var arguments = WSAApplication.arguments;
             if (arguments.Contains("appcenterunity"))
             {
                 var idPrefix   = "\"appcenterunity\":\"";
                 var idStartIdx = arguments.IndexOf(idPrefix) + idPrefix.Length;
                 var idString   = arguments.Substring(idStartIdx, _idLength);
                 if (idString != _prevIdString)
                 {
                     _prevIdString = idString;
                     UWPPush.Instance.InstanceCheckLaunchedFromNotification(WSAApplication.arguments);
                 }
             }
         }), false);
     };
     UWPPush.PushNotificationReceived += (sender, e) =>
     {
         var eventArgs = new PushNotificationReceivedEventArgs
         {
             Message    = e.Message,
             Title      = e.Title,
             CustomData = e.CustomData
         };
         HandlePushNotification(eventArgs);
     };
 }
 public static void StartCoroutine(Func <IEnumerator> coroutine)
 {
     if (WSAApplication.RunningOnAppThread())
     {
         Instance.StartCoroutine(coroutine());
     }
     else
     {
         WSAApplication.InvokeOnAppThread(() =>
         {
             Instance.StartCoroutine(coroutine());
         }, false);
     }
 }