Пример #1
0
        IEnumerator CRRaiseLocalNotificationEvent(AndroidNotificationResponse response, bool isForeground)
        {
            // This could be called at app-launch-from-notification, so we'd better
            // check if the Helper is ready before asking it to schedule a job on main thread.
            while (!Helper.IsInitialized())
            {
                yield return(new WaitForSeconds(0.1f));
            }

            Helper.RunOnMainThread(() =>
            {
                string actionId = response.actionId;
                var request     = response.request.ToCrossPlatformNotificationRequest();

                var delivered = new LocalNotification(
                    request.id,
                    actionId,
                    request.content,
                    isForeground,
                    isForeground ? false : true                     // isOpened
                    );

                if (LocalNotificationOpened != null)
                {
                    LocalNotificationOpened(delivered);
                }
            });
        }
Пример #2
0
        void InternalOnLocalNotificationHandler(bool isForeground, String jsonResponse)
        {
            var response = AndroidNotificationResponse.FromJson(jsonResponse);

            if (response == null || response.request == null)
            {
                Debug.Log("Ignoring local Android notification due to invalid JSON response data.");
                return;
            }

            StartCoroutine(CRRaiseLocalNotificationEvent(response, isForeground));
        }