Example #1
0
        private string PushMessageToAppAndroid(RequestPushMessageToApp req)
        {
            IGtPush push = new IGtPush(HOST, APPKEY, MASTERSECRET);

            AppMessage message = new AppMessage();

            NotificationTemplate template = NotificationTemplateAndroid(req.Title);

            message.IsOffline = true;                         // 用户当前不在线时,是否离线存储,可选
            message.OfflineExpireTime = 1000 * 3600 * 12;            // 离线有效时间,单位为毫秒,可选
            message.Data = template;

            List<String> appIdList = new List<string>();
            appIdList.Add(APPID);

            List<String> phoneTypeList = new List<string>();    //通知接收者的手机操作系统类型
            phoneTypeList.Add("ANDROID");
            //phoneTypeList.Add("IOS");

            List<String> provinceList = new List<string>();     //通知接收者所在省份

            message.AppIdList = appIdList;
            message.PhoneTypeList = phoneTypeList;
            message.ProvinceList = provinceList;

            String pushResult = push.pushMessageToApp(message);
            return pushResult;
        }
Example #2
0
 public IHttpActionResult PushMessageToApp(RequestPushMessageToApp req)
 {
     var result = PushMessageToAppIOS(req);
     PushMessageToAppAndroid(req);
     return Ok(result);
 }