Skip to content

Commit 0ed121c

Browse files
committed
Update example
1 parent 083a296 commit 0ed121c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

example/main/java/cn/jpush/api/examples/PushExample.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,10 @@ public static void buildPushObject_with_extra() {
286286
}
287287

288288
public static PushPayload buildPushObject_ios_tagAnd_alertWithExtrasAndMessage() {
289+
JsonObject sound = new JsonObject();
290+
sound.add("critical", new JsonPrimitive(1));
291+
sound.add("name", new JsonPrimitive("default"));
292+
sound.add("volume", new JsonPrimitive(0.2));
289293
return PushPayload.newBuilder()
290294
.setPlatform(Platform.ios())
291295
.setAudience(Audience.tag_and("tag1", "tag_all"))
@@ -294,7 +298,8 @@ public static PushPayload buildPushObject_ios_tagAnd_alertWithExtrasAndMessage()
294298
.setAlert(ALERT)
295299
.setBadge(5)
296300
.setMutableContent(false)
297-
.setSound("happy")
301+
// .setSound("happy")
302+
.setSound(sound)
298303
.addExtra("from", "JPush")
299304
.build())
300305
.build())
@@ -306,11 +311,16 @@ public static PushPayload buildPushObject_ios_tagAnd_alertWithExtrasAndMessage()
306311
}
307312

308313
public static PushPayload buildPushObject_android_newly_support() {
314+
309315
JsonObject inbox = new JsonObject();
310316
inbox.add("line1", new JsonPrimitive("line1 string"));
311317
inbox.add("line2", new JsonPrimitive("line2 string"));
312318
inbox.add("contentTitle", new JsonPrimitive("title string"));
313319
inbox.add("summaryText", new JsonPrimitive("+3 more"));
320+
321+
JsonObject intent = new JsonObject();
322+
intent.add("url", new JsonPrimitive("intent:#Intent;component=com.jiguang.push/com.example.jpushdemo.SettingActivity;end"));
323+
314324
Notification notification = Notification.newBuilder()
315325
.addPlatformNotification(AndroidNotification.newBuilder()
316326
.setAlert(ALERT)
@@ -322,6 +332,8 @@ public static PushPayload buildPushObject_android_newly_support() {
322332
.setStyle(1)
323333
.setTitle("Alert test")
324334
.setPriority(1)
335+
.setLargeIcon("http://www.jiguang.cn/largeIcon.jpg")
336+
.setIntent(intent)
325337
.build())
326338
.build();
327339
return PushPayload.newBuilder()

0 commit comments

Comments
 (0)