@@ -37,7 +37,7 @@ public class PushExample {
3737
3838 // demo App defined in resources/jpush-api.conf
3939 protected static final String APP_KEY ="d4ee2375846bc30fa51334f5" ;
40- protected static final String MASTER_SECRET = "61807e56ddaebf2e47172159 " ;
40+ protected static final String MASTER_SECRET = "f3b222f7e0dde430b6d8fa5a " ;
4141 protected static final String GROUP_PUSH_KEY = "2c88a01e073a0fe4fc7b167c" ;
4242 protected static final String GROUP_MASTER_SECRET = "b11314807507e2bcfdeebe2e" ;
4343
@@ -52,7 +52,8 @@ public class PushExample {
5252 public static void main (String [] args ) {
5353// testSendPushWithCustomConfig();
5454// testSendIosAlert();
55- testSendPush ();
55+ // testSendPush();
56+ testGetCidList ();
5657// testSendPushes();
5758// testSendPush_fromJSON();
5859// testSendPushWithCallback();
@@ -81,14 +82,12 @@ public void onSucceed(ResponseWrapper responseWrapper) {
8182 public static void testSendPush () {
8283 ClientConfig clientConfig = ClientConfig .getInstance ();
8384 final JPushClient jpushClient = new JPushClient (MASTER_SECRET , APP_KEY , null , clientConfig );
84- String authCode = ServiceHelper .getBasicAuthorization (APP_KEY , MASTER_SECRET );
8585 // Here you can use NativeHttpClient or NettyHttpClient or ApacheHttpClient.
86- NativeHttpClient httpClient = new NativeHttpClient (authCode , null , clientConfig );
8786 // Call setHttpClient to set httpClient,
8887 // If you don't invoke this method, default httpClient will use NativeHttpClient.
8988// ApacheHttpClient httpClient = new ApacheHttpClient(authCode, null, clientConfig);
9089// jpushClient.getPushClient().setHttpClient(httpClient);
91- final PushPayload payload = buildPushObject_ios_tagAnd_alertWithExtrasAndMessage ();
90+ final PushPayload payload = buildPushObject_android_and_ios ();
9291// // For push, all you need do is to build PushPayload object.
9392// PushPayload payload = buildPushObject_all_alias_alert();
9493 try {
@@ -226,13 +225,16 @@ public static PushPayload buildPushObject_android_tag_alertWithTitle() {
226225 }
227226
228227 public static PushPayload buildPushObject_android_and_ios () {
228+ Map <String , String > extras = new HashMap <String , String >();
229+ extras .put ("test" , "https://community.jiguang.cn/push" );
229230 return PushPayload .newBuilder ()
230231 .setPlatform (Platform .android_ios ())
231- .setAudience (Audience .tag ( "tag1" ))
232+ .setAudience (Audience .all ( ))
232233 .setNotification (Notification .newBuilder ()
233234 .setAlert ("alert content" )
234235 .addPlatformNotification (AndroidNotification .newBuilder ()
235- .setTitle ("Android Title" ).build ())
236+ .setTitle ("Android Title" )
237+ .addExtras (extras ).build ())
236238 .addPlatformNotification (IosNotification .newBuilder ()
237239 .incrBadge (1 )
238240 .addExtra ("extra_key" , "extra_value" ).build ())
@@ -416,7 +418,7 @@ public static void testSendWithSMS() {
416418 public static void testGetCidList () {
417419 JPushClient jPushClient = new JPushClient (MASTER_SECRET , APP_KEY );
418420 try {
419- CIDResult result = jPushClient .getCidList (3 , null );
421+ CIDResult result = jPushClient .getCidList (3 , "push" );
420422 LOG .info ("Got result - " + result );
421423 } catch (APIConnectionException e ) {
422424 LOG .error ("Connection error. Should retry later. " , e );
0 commit comments