11
11
import cn .jpush .api .push .model .Platform ;
12
12
import cn .jpush .api .push .model .PushPayload ;
13
13
import 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 ;
16
14
import cn .jpush .api .push .model .notification .Notification ;
17
15
import cn .jpush .api .report .MessagesResult ;
18
16
import cn .jpush .api .report .ReceivedsResult ;
@@ -125,13 +123,7 @@ public PushResult sendAndroidNotificationWithAlias(String title, String alert,
125
123
PushPayload payload = PushPayload .newBuilder ()
126
124
.setPlatform (Platform .android ())
127
125
.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 ))
135
127
.build ();
136
128
return _pushClient .sendPush (payload );
137
129
}
@@ -145,13 +137,7 @@ public PushResult sendAndroidNotificationWithRegistrationID(String title, String
145
137
PushPayload payload = PushPayload .newBuilder ()
146
138
.setPlatform (Platform .android ())
147
139
.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 ))
155
141
.build ();
156
142
return _pushClient .sendPush (payload );
157
143
}
@@ -165,16 +151,11 @@ public PushResult sendIosNotificationWithAlias(String alert,
165
151
PushPayload payload = PushPayload .newBuilder ()
166
152
.setPlatform (Platform .ios ())
167
153
.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 ))
174
155
.build ();
175
156
return _pushClient .sendPush (payload );
176
157
}
177
-
158
+
178
159
/**
179
160
* Shortcut
180
161
*/
@@ -184,12 +165,7 @@ public PushResult sendIosNotificationWithRegistrationID(String alert,
184
165
PushPayload payload = PushPayload .newBuilder ()
185
166
.setPlatform (Platform .ios ())
186
167
.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 ))
193
169
.build ();
194
170
return _pushClient .sendPush (payload );
195
171
}
0 commit comments