1111import cn .jpush .api .push .model .Platform ;
1212import cn .jpush .api .push .model .PushPayload ;
1313import cn .jpush .api .push .model .audience .Audience ;
14- import cn .jpush .api .push .model .notification .AndroidNotification ;
15- import cn .jpush .api .push .model .notification .IosNotification ;
1614import cn .jpush .api .push .model .notification .Notification ;
1715import cn .jpush .api .report .MessagesResult ;
1816import cn .jpush .api .report .ReceivedsResult ;
@@ -125,13 +123,7 @@ public PushResult sendAndroidNotificationWithAlias(String title, String alert,
125123 PushPayload payload = PushPayload .newBuilder ()
126124 .setPlatform (Platform .android ())
127125 .setAudience (Audience .alias (alias ))
128- .setNotification (Notification .newBuilder ()
129- .addPlatformNotification (AndroidNotification .newBuilder ()
130- .setTitle (title )
131- .setAlert (alert )
132- .addExtras (extras )
133- .build ())
134- .build ())
126+ .setNotification (Notification .android (alert , title , extras ))
135127 .build ();
136128 return _pushClient .sendPush (payload );
137129 }
@@ -145,13 +137,7 @@ public PushResult sendAndroidNotificationWithRegistrationID(String title, String
145137 PushPayload payload = PushPayload .newBuilder ()
146138 .setPlatform (Platform .android ())
147139 .setAudience (Audience .registrationId (registrationID ))
148- .setNotification (Notification .newBuilder ()
149- .addPlatformNotification (AndroidNotification .newBuilder ()
150- .setTitle (title )
151- .setAlert (alert )
152- .addExtras (extras )
153- .build ())
154- .build ())
140+ .setNotification (Notification .android (alert , title , extras ))
155141 .build ();
156142 return _pushClient .sendPush (payload );
157143 }
@@ -165,16 +151,11 @@ public PushResult sendIosNotificationWithAlias(String alert,
165151 PushPayload payload = PushPayload .newBuilder ()
166152 .setPlatform (Platform .ios ())
167153 .setAudience (Audience .alias (alias ))
168- .setNotification (Notification .newBuilder ()
169- .addPlatformNotification (IosNotification .newBuilder ()
170- .setAlert (alert )
171- .addExtras (extras )
172- .build ())
173- .build ())
154+ .setNotification (Notification .ios (alert , extras ))
174155 .build ();
175156 return _pushClient .sendPush (payload );
176157 }
177-
158+
178159 /**
179160 * Shortcut
180161 */
@@ -184,12 +165,7 @@ public PushResult sendIosNotificationWithRegistrationID(String alert,
184165 PushPayload payload = PushPayload .newBuilder ()
185166 .setPlatform (Platform .ios ())
186167 .setAudience (Audience .registrationId (registrationID ))
187- .setNotification (Notification .newBuilder ()
188- .addPlatformNotification (IosNotification .newBuilder ()
189- .setAlert (alert )
190- .addExtras (extras )
191- .build ())
192- .build ())
168+ .setNotification (Notification .ios (alert , extras ))
193169 .build ();
194170 return _pushClient .sendPush (payload );
195171 }
0 commit comments