diff --git a/README.md b/README.md
index cc0150cf..48440cc0 100644
--- a/README.md
+++ b/README.md
@@ -26,7 +26,7 @@
cn.jpush.api
jpush-client
- 3.3.2
+ 3.3.3
```
### jar 包方式
diff --git a/example/main/java/cn/jpush/api/examples/PushExample.java b/example/main/java/cn/jpush/api/examples/PushExample.java
index 35f7532d..85925bec 100644
--- a/example/main/java/cn/jpush/api/examples/PushExample.java
+++ b/example/main/java/cn/jpush/api/examples/PushExample.java
@@ -6,8 +6,6 @@
import java.util.Map;
import cn.jiguang.common.ServiceHelper;
-import cn.jiguang.common.connection.ApacheHttpClient;
-import cn.jiguang.common.connection.HttpProxy;
import cn.jiguang.common.connection.NativeHttpClient;
import cn.jiguang.common.connection.NettyHttpClient;
import cn.jiguang.common.resp.ResponseWrapper;
@@ -183,13 +181,21 @@ public void run() {
}
}
- public static void testSendGroupPush() {
+ public void testSendGroupPush() {
GroupPushClient groupPushClient = new GroupPushClient(GROUP_MASTER_SECRET, GROUP_PUSH_KEY);
final PushPayload payload = buildPushObject_android_and_ios();
try {
- PushResult result = groupPushClient.sendGroupPush(payload);
- LOG.info("Got result - " + result);
+ Map result = groupPushClient.sendGroupPush(payload);
+ for (Map.Entry entry : result.entrySet()) {
+ PushResult pushResult = entry.getValue();
+ PushResult.Error error = pushResult.error;
+ if (error != null) {
+ LOG.info("AppKey: " + entry.getKey() + " error code : " + error.getCode() + " error message: " + error.getMessage());
+ } else {
+ LOG.info("AppKey: " + entry.getKey() + " sendno: " + pushResult.sendno + " msg_id:" + pushResult.msg_id);
+ }
+ }
} catch (APIConnectionException e) {
LOG.error("Connection error. Should retry later. ", e);
LOG.error("Sendno: " + payload.getSendno());
diff --git a/pom.xml b/pom.xml
index 119e2537..3efab121 100644
--- a/pom.xml
+++ b/pom.xml
@@ -35,7 +35,7 @@
https://github.com/jpush/jpush-api-java-client
scm:git:git@github.com:jpush/jpush-api-java-client.git
scm:git:git@github.com:jpush/jpush-api-java-client.git
- v3.3.2
+ v3.3.3
diff --git a/src/main/java/cn/jpush/api/push/GroupPushClient.java b/src/main/java/cn/jpush/api/push/GroupPushClient.java
index 95c46c03..ccecf079 100644
--- a/src/main/java/cn/jpush/api/push/GroupPushClient.java
+++ b/src/main/java/cn/jpush/api/push/GroupPushClient.java
@@ -7,10 +7,13 @@
import cn.jiguang.common.connection.NativeHttpClient;
import cn.jiguang.common.resp.APIConnectionException;
import cn.jiguang.common.resp.APIRequestException;
-import cn.jiguang.common.resp.BaseResult;
import cn.jiguang.common.resp.ResponseWrapper;
import cn.jiguang.common.utils.Preconditions;
import cn.jpush.api.push.model.PushPayload;
+import com.google.gson.Gson;
+import com.google.gson.reflect.TypeToken;
+
+import java.util.Map;
/**
* Created by caiyaoguan on 2017/7/4.
@@ -20,6 +23,7 @@ public class GroupPushClient {
private IHttpClient _httpClient;
private String _baseUrl;
private String _groupPushPath;
+ private Gson _gson = new Gson();
public GroupPushClient(String groupMasterSecret, String groupKey) {
this(groupMasterSecret, groupKey, null, ClientConfig.getInstance());
@@ -33,12 +37,12 @@ public GroupPushClient(String groupMasterSecret, String groupKey, HttpProxy prox
this._httpClient = new NativeHttpClient(authCode, proxy, conf);
}
- public PushResult sendGroupPush(PushPayload pushPayload) throws APIConnectionException, APIRequestException {
+ public Map sendGroupPush(PushPayload pushPayload) throws APIConnectionException, APIRequestException {
Preconditions.checkArgument(! (null == pushPayload), "pushPayload should not be null");
ResponseWrapper response = _httpClient.sendPost(_baseUrl + _groupPushPath, pushPayload.toString());
-
- return BaseResult.fromResponse(response, PushResult.class);
+ return _gson.fromJson(response.responseContent,
+ new TypeToken