File tree Expand file tree Collapse file tree 3 files changed +15
-7
lines changed
Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change 44import org .slf4j .LoggerFactory ;
55
66import cn .jpush .api .JPushClient ;
7+ import cn .jpush .api .push .model .PushPayload ;
78import cn .jpush .api .report .ReceivedsResult ;
89
910public class JPushClientExample {
@@ -19,13 +20,23 @@ public class JPushClientExample {
1920 public static final String TAG = "tag_api" ;
2021
2122 public static void main (String [] args ) {
22- testSend ();
23+ //testSendNotification();
24+ testSendMesasge ();
2325 testGetReport ();
2426 }
25-
26- private static void testSend () {
27+
28+ private static void testSendNotification () {
29+ JPushClient jpushClient = new JPushClient (masterSecret , appKey );
30+ PushPayload payload = PushPayload .notificationAlertAll (CONTENT );
31+ jpushClient .sendPush (payload );
2732 }
2833
34+ private static void testSendMesasge () {
35+ JPushClient jpushClient = new JPushClient (masterSecret , appKey );
36+ PushPayload payload = PushPayload .simpleMessageAll (CONTENT );
37+ jpushClient .sendPush (payload );
38+ }
39+
2940 public static void testGetReport () {
3041 JPushClient jpushClient = new JPushClient (masterSecret , appKey );
3142 ReceivedsResult receivedsResult = jpushClient .getReportReceiveds ("1708010723,1774452771" );
Original file line number Diff line number Diff line change 66
77import cn .jpush .api .common .BaseHttpClient ;
88import cn .jpush .api .common .ResponseResult ;
9- import cn .jpush .api .common .ValidateRequestParams ;
109import cn .jpush .api .report .ReceivedsResult .Received ;
1110import cn .jpush .api .utils .StringUtils ;
1211
@@ -39,7 +38,7 @@ public ReceivedsResult getReceiveds(String msgIds) {
3938 }
4039
4140 public ReceivedsResult getResportReceived (String msgIds , String authCode ) {
42- ValidateRequestParams . checkReportParams ( _appKey , _masterSecret , msgIds );
41+ checkMsgids ( msgIds );
4342
4443 String url = REPORT_HOST_NAME + REPORT_RECEIVE_PATH + "?msg_ids=" + msgIds ;
4544 ResponseResult result = sendGet (url , null , authCode );
Original file line number Diff line number Diff line change @@ -97,7 +97,5 @@ public void sendNotificationWithTagByExtra(){
9797 PushResult result = jpushClient .sendNotification (MSG_CONTENT , params , null );
9898 assertEquals (SUCCEED_RESULT_CODE , result .getErrorCode ());
9999 }
100-
101100}
102101
103-
You can’t perform that action at this time.
0 commit comments