示例#1
0
        /// <summary>
        /// Gets device details if registered
        /// </summary>
        /// <param name="channelName">Channel name the device registered</param>
        /// <param name="callback">Method to be called just after getting details</param>
        public static void getDeviceDetail(String channelName, Action <NetmeraDeviceDetail, Exception> callback)
        {
            Channel_Name = channelName;
            Channel      = HttpNotificationChannel.Find(Channel_Name);
            if (Channel != null)
            {
                NetmeraDeviceDetail deviceDetail = new NetmeraDeviceDetail(Channel.ChannelUri.ToString());

                Dictionary <string, object> postParameters = new Dictionary <string, object>();
                postParameters.Add(NetmeraConstants.Netmera_Push_Registration_Id, deviceDetail.regId);
                postParameters.Add(NetmeraConstants.Netmera_Push_Apikey, NetmeraClient.securityToken);

                String url = NetmeraConstants.Netmera_Domain_Url + NetmeraConstants.Netmera_Push_Server_Url + NetmeraConstants.Netmera_Push_Device_Details;

                NetmeraHttpUtils.getDeviceDetails(url, postParameters, deviceDetail, callback);
            }
            else if (callback != null)
            {
                callback(null, new NetmeraException(NetmeraException.ErrorCode.EC_PUSH_DEVICE_NOT_REGISTERED, "A channel with such a name is not registered"));
            }
        }