Esempio n. 1
0
        internal static void _GetPendingLocalNotifications(Action <AndroidNotificationRequest[]> callback)
        {
            Helper.NullArgumentTest(callback);

            var requests = new List <AndroidNotificationRequest>();
            var jObj     = AndroidUtil.CallJavaStaticMethod <AndroidJavaObject>(
                ANDROID_JAVA_CLASS,
                "_GetPendingNotificationRequestsJson");

            // The JNI array conversion method will crash if the raw object value is 0.
            if (jObj.GetRawObject().ToInt32() != 0)
            {
                var jsonStrs = AndroidJNIHelper.ConvertFromJNIArray <string[]>(jObj.GetRawObject());
                foreach (string s in jsonStrs)
                {
                    var req = AndroidNotificationRequest.FromJson(s);
                    if (req != null)
                    {
                        requests.Add(req);
                    }
                }
            }

            jObj.Dispose();
            callback(requests.ToArray());
        }
Esempio n. 2
0
        internal static AndroidNotificationResponse FromJson(string jsonData)
        {
            var    dict     = Json.Deserialize(jsonData) as Dictionary <string, object>;
            string actionId = null;
            AndroidNotificationRequest request = null;

            if (dict.ContainsKey("actionId"))
            {
                actionId = dict["actionId"] as string;
            }

            if (dict.ContainsKey("request"))
            {
                request = AndroidNotificationRequest.FromJson((string)dict["request"]);
            }

            return(new AndroidNotificationResponse(actionId, request));
        }