public updateDevice ( String registrationId, String alias, String mobile, HashSet |
||
registrationId | String | |
alias | String | |
mobile | String | |
tagsToAdd | HashSet |
|
tagsToRemove | HashSet |
|
return | cn.jpush.api.common.resp.DefaultResult |
public static void Main(string[] args) { Console.WriteLine("*****开始获取设备信息******"); DeviceClient client = new DeviceClient(app_key, master_secret); //get device tag alias try { var result = client.getDeviceTagAlias(REGISTRATION_ID); //由于统计数据并非非是即时的,所以等待一小段时间再执行下面的获取结果方法 System.Threading.Thread.Sleep(10000); //如需查询上次推送结果执行下面的代码 Console.WriteLine(result); //如需查询某个messageid的推送结果执行下面的代码 } catch (APIRequestException e) { Console.WriteLine("Error response from JPush server. Should review and fix it. "); Console.WriteLine("HTTP Status: " + e.Status); Console.WriteLine("Error Code: " + e.ErrorCode); Console.WriteLine("Error Message: " + e.ErrorMessage); } catch (APIConnectionException e) { Console.WriteLine(e.Message); } // update Device ALIAS,MOBILE,TAG try { var result = client.updateDevice(REGISTRATION_ID, ALIAS, MOBILE, TAG_HASHSET, TAG_HASHSET_REMOVE ); //由于统计数据并非非是即时的,所以等待一小段时间再执行下面的获取结果方法 System.Threading.Thread.Sleep(10000); //如需查询上次推送结果执行下面的代码 Console.WriteLine(result); //如需查询某个messageid的推送结果执行下面的代码 } catch (APIRequestException e) { Console.WriteLine("Error response from JPush server. Should review and fix it. "); Console.WriteLine("HTTP Status: " + e.Status); Console.WriteLine("Error Code: " + e.ErrorCode); Console.WriteLine("Error Message: " + e.ErrorMessage); } catch (APIConnectionException e) { Console.WriteLine(e.Message); } //get tag list demo try { var result = client.getTagList(); //由于统计数据并非非是即时的,所以等待一小段时间再执行下面的获取结果方法 System.Threading.Thread.Sleep(10000); //如需查询上次推送结果执行下面的代码 Console.WriteLine(result); //如需查询某个messageid的推送结果执行下面的代码 } catch (APIRequestException e) { Console.WriteLine("Error response from JPush server. Should review and fix it. "); Console.WriteLine("HTTP Status: " + e.Status); Console.WriteLine("Error Code: " + e.ErrorCode); Console.WriteLine("Error Message: " + e.ErrorMessage); } catch (APIConnectionException e) { Console.WriteLine(e.Message); } //get device tag alias try { var result = client.getDeviceTagAlias(REGISTRATION_ID); //由于统计数据并非非是即时的,所以等待一小段时间再执行下面的获取结果方法 System.Threading.Thread.Sleep(10000); //如需查询上次推送结果执行下面的代码 Console.WriteLine(result); //如需查询某个messageid的推送结果执行下面的代码 } catch (APIRequestException e) { Console.WriteLine("Error response from JPush server. Should review and fix it. "); Console.WriteLine("HTTP Status: " + e.Status); Console.WriteLine("Error Code: " + e.ErrorCode); Console.WriteLine("Error Message: " + e.ErrorMessage); } catch (APIConnectionException e) { Console.WriteLine(e.Message); } try { var result = client.updateDeviceTagAlias(REGISTRATION_ID, true, true); //由于统计数据并非非是即时的,所以等待一小段时间再执行下面的获取结果方法 System.Threading.Thread.Sleep(10000); //如需查询上次推送结果执行下面的代码 Console.WriteLine(result); //如需查询某个messageid的推送结果执行下面的代码 } catch (APIRequestException e) { Console.WriteLine("Error response from JPush server. Should review and fix it. "); Console.WriteLine("HTTP Status: " + e.Status); Console.WriteLine("Error Code: " + e.ErrorCode); Console.WriteLine("Error Message: " + e.ErrorMessage); } catch (APIConnectionException e) { Console.WriteLine(e.Message); } //get the device tag alias mobile try { var result = client.getDeviceTagAlias(REGISTRATION_ID); //由于统计数据并非非是即时的,所以等待一小段时间再执行下面的获取结果方法 System.Threading.Thread.Sleep(10000); //如需查询上次推送结果执行下面的代码 Console.WriteLine(result); //如需查询某个messageid的推送结果执行下面的代码 } catch (APIRequestException e) { Console.WriteLine("Error response from JPush server. Should review and fix it. "); Console.WriteLine("HTTP Status: " + e.Status); Console.WriteLine("Error Code: " + e.ErrorCode); Console.WriteLine("Error Message: " + e.ErrorMessage); } catch (APIConnectionException e) { Console.WriteLine(e.Message); } //TagAliasResult getDeviceTagAlias(String registrationId) Console.WriteLine("*****结束获取设备信息******"); //get the device tag alias mobile try { var result = client.getDeviceStatus(REGISTRATION_IDS); //由于统计数据并非非是即时的,所以等待一小段时间再执行下面的获取结果方法 System.Threading.Thread.Sleep(10000); //如需查询上次推送结果执行下面的代码 Console.WriteLine(result); //如需查询某个messageid的推送结果执行下面的代码 } catch (APIRequestException e) { Console.WriteLine("Error response from JPush server. Should review and fix it. "); Console.WriteLine("HTTP Status: " + e.Status); Console.WriteLine("Error Code: " + e.ErrorCode); Console.WriteLine("Error Message: " + e.ErrorMessage); } catch (APIConnectionException e) { Console.WriteLine(e.Message); } //TagAliasResult getDeviceTagAlias(String registrationId) Console.WriteLine("*****结束获取设备信息******"); }
public void updateDeviceInvalidMobileTest() { DeviceClient client = new DeviceClient(APP_KEY, MASTER_SECRET); client.updateDevice(REGISTRATION_ID1, "alias", "13", TAG_HASHSET_EMPTY, TAG_HASHSET_EMPTY); }
public void updateDeviceNullTest() { DeviceClient client = new DeviceClient(APP_KEY, MASTER_SECRET); client.updateDevice(REGISTRATION_ID1,null,null, TAG_HASHSET_EMPTY, TAG_HASHSET_EMPTY); }
public void updateDeviceEmptyTest() { DeviceClient client = new DeviceClient(APP_KEY, MASTER_SECRET); client.updateDevice(REGISTRATION_ID1, "", "13888888888", TAG_HASHSET_EMPTY, TAG_HASHSET_EMPTY); }