File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed
main/java/cn/jpush/api/push/model/notification
test/java/cn/jpush/api/push Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -193,7 +193,7 @@ public JsonElement toJSON() {
193193 json .add (STYLE , new JsonPrimitive (this .style ));
194194 }
195195
196- if (-1 != alert_type ) {
196+ if (-1 != alert_type && alert_type <= 7 ) {
197197 json .add (ALERT_TYPE , new JsonPrimitive (this .alert_type ));
198198 }
199199
Original file line number Diff line number Diff line change @@ -216,4 +216,19 @@ private static PushPayload buildPushObject_android_cid() {
216216 .build ();
217217 }
218218
219+ @ Test
220+ public void testAlertType (){
221+ Notification notification = Notification .newBuilder ()
222+ .addPlatformNotification (AndroidNotification .newBuilder ()
223+ .setAlert ("android内容" )
224+ .setTitle ("android标题" )
225+ .setAlertType (-1 )
226+ .addCustom ("uri_activity" ,"uri_activity" )
227+ .addCustom ("uri_action" ,"uri_action" )
228+ .addExtra ("a" ,"a" )
229+ .build ()
230+ ).build ();
231+ System .out .println (notification .toJSON ());
232+ }
233+
219234}
You can’t perform that action at this time.
0 commit comments