Beispiel #1
0
    public void PushNotification2Androids(string alertText, string[] apids, string extra)
    {
        if (!string.IsNullOrEmpty(alertText) && apids.Length > 0)
        {
            AndroidPushNotification pushNotification = new AndroidPushNotification
            {
                MessageBody = new AndroidPushNotificationMessageBody
                {
                    Alert = alertText,
                    Extra = extra
                },
                APIDs = apids
            };
            string jsonMessageRequest = pushNotification.ToJsonString();

            try
            {
                SendMessageToUrbanAirship(jsonMessageRequest);
                log4netEngine.InfoFormat("Push Notification Success , androidDevice:{0}, message:{1},extra:{2}", string.Join(",", apids), alertText, extra);
            }
            catch (Exception ex)
            {
                log4netEngine.InfoFormat("Push Notification Error:{0}, androidDevice:{1}, message:{2},extra:{3}", ex.Message, string.Join(",", apids), alertText, extra);
            }
        }
    }
Beispiel #2
0
 public void OnPushNotificationReceived(Activity activity, AndroidPushNotification notification)
 {
     OnPushNotificationReceivedAction?.Invoke(notification);
 }