11package cn .jpush .api .examples ;
22
3+ import java .util .HashMap ;
4+ import java .util .Map ;
5+
36import org .slf4j .Logger ;
47import org .slf4j .LoggerFactory ;
58
69import cn .jpush .api .JPushClient ;
710import cn .jpush .api .common .DeviceEnum ;
811import cn .jpush .api .push .CustomMessageParams ;
912import cn .jpush .api .push .MessageResult ;
13+ import cn .jpush .api .push .NotificationParams ;
1014import cn .jpush .api .push .ReceiverTypeEnum ;
1115import cn .jpush .api .report .ReceivedsResult ;
1216
@@ -24,9 +28,23 @@ public class JPushClientExample {
2428
2529 public static void main (String [] args ) {
2630 testSend ();
31+ testSendMpnsNotificaiton ();
2732 testGetReport ();
2833 }
29-
34+
35+ private static void testSendMpnsNotificaiton () {
36+ JPushClient jpushClient = new JPushClient (masterSecret , appKey , 0 , DeviceEnum .MPNS , false );
37+ NotificationParams params = new NotificationParams ();
38+ params .setReceiverType (ReceiverTypeEnum .TAG );
39+ params .setReceiverValue (tag );
40+ params .setMpnsNotificationTitle (msgTitle );
41+
42+ Map <String , Object > extras = new HashMap <String , Object >();
43+ extras .put (NotificationParams .MPNS_EXTRA_OPEN_PAGE , "MainPage.xaml" );
44+
45+ MessageResult msgResult = jpushClient .sendNotification (msgContent , params , extras );
46+ }
47+
3048 private static void testSend () {
3149 JPushClient jpushClient = new JPushClient (masterSecret , appKey , 0 , DeviceEnum .Android , false );
3250 CustomMessageParams params = new CustomMessageParams ();
0 commit comments