55
66import cn .jpush .api .JPushClient ;
77import cn .jpush .api .common .DeviceEnum ;
8- import cn .jpush .api .push .CustomMessageParams ;
98import cn .jpush .api .push .MessageResult ;
9+ import cn .jpush .api .push .NotificationParams ;
1010import cn .jpush .api .push .ReceiverTypeEnum ;
1111import cn .jpush .api .report .ReceivedsResult ;
1212
@@ -17,10 +17,10 @@ public class JPushClientExample {
1717 private static final String appKey ="dd1066407b044738b6479275" ;
1818 private static final String masterSecret = "2b38ce69b1de2a7fa95706ea" ;
1919
20- public static final String msgTitle = "Test from API example" ;
21- public static final String msgContent = "Test Test" ;
22- public static final String registrationID = "0900e8d85ef" ;
23- public static final String tag = "tag_api" ;
20+ public static final String TITLE = "Test from API example" ;
21+ public static final String CONTENT = "Test Test" ;
22+ public static final String REGISTRATION_ID = "0900e8d85ef" ;
23+ public static final String TAG = "tag_api" ;
2424
2525 public static void main (String [] args ) {
2626 testSend ();
@@ -29,13 +29,13 @@ public static void main(String[] args) {
2929
3030 private static void testSend () {
3131 JPushClient jpushClient = new JPushClient (masterSecret , appKey , 0 , DeviceEnum .Android , false );
32- CustomMessageParams params = new CustomMessageParams ();
32+ NotificationParams params = new NotificationParams ();
3333 //params.setReceiverType(ReceiverTypeEnum.REGISTRATION_ID);
3434 //params.setReceiverValue(registrationID);
3535 params .setReceiverType (ReceiverTypeEnum .TAG );
36- params .setReceiverValue (tag );
36+ params .setReceiverValue (TAG );
3737
38- MessageResult msgResult = jpushClient .sendCustomMessage ( msgTitle , msgContent , params , null );
38+ MessageResult msgResult = jpushClient .sendNotification ( CONTENT , params , null );
3939 LOG .debug ("responseContent - " + msgResult .responseResult .responseContent );
4040 if (msgResult .isResultOK ()) {
4141 LOG .info ("msgResult - " + msgResult );
0 commit comments