Skip to content
This repository was archived by the owner on Dec 30, 2024. It is now read-only.

Commit f7704cf

Browse files
committed
Added dry run mode sample
1 parent 210c052 commit f7704cf

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

admin/src/main/java/com/google/firebase/example/FirebaseMessagingSnippets.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,22 @@ public void sendToCondition() throws Exception {
9696
// [END send_to_condition]
9797
}
9898

99+
public void sendDryRun() throws Exception {
100+
Message message = Message.builder()
101+
.putData("score", "850")
102+
.putData("time", "2:45")
103+
.setToken("token")
104+
.build();
105+
106+
// [START send_dry_run]
107+
// Send a message in the dry run mode.
108+
boolean dryRun = true;
109+
String response = FirebaseMessaging.getInstance().sendAsync(message, dryRun).get();
110+
// Response is a message ID string.
111+
System.out.println("Dry run successful: " + response);
112+
// [END send_dry_run]
113+
}
114+
99115
public Message androidMessage() {
100116
// [START android_message]
101117
Message message = Message.builder()

0 commit comments

Comments
 (0)