Skip to content

Commit 48a3915

Browse files
authored
JavaV2: Update sns RegistrationExample formatting (#6791)
updated para description for token
1 parent 6f2c61f commit 48a3915

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

javav2/example_code/sns/src/main/java/com/example/sns/RegistrationExample.java

+16-13
Original file line numberDiff line numberDiff line change
@@ -33,40 +33,43 @@ public class RegistrationExample {
3333
public static void main(String[] args) {
3434
final String usage = """
3535
36-
Usage: <token> <platformApplicationArn>
36+
Usage: <token> <platformApplicationArn>
3737
38-
Where:
39-
token - The name of the FIFO topic.\s
40-
platformApplicationArn - The ARN value of platform application. You can get this value from the AWS Management Console.\s
41-
""";
38+
Where:
39+
token - The device token or registration ID of the mobile device. This is a unique
40+
identifier provided by the device platform (e.g., Apple Push Notification Service (APNS) for iOS devices, Firebase Cloud Messaging (FCM)
41+
for Android devices) when the mobile app is registered to receive push notifications.
42+
43+
platformApplicationArn - The ARN value of platform application. You can get this value from the AWS Management Console.\s
44+
45+
""";
4246

4347
if (args.length != 2) {
4448
System.out.println(usage);
45-
System.exit(1);
49+
return;
4650
}
4751

4852
String token = args[0];
4953
String platformApplicationArn = args[1];
5054
SnsClient snsClient = SnsClient.builder()
51-
.region(Region.US_EAST_1)
52-
.build();
55+
.region(Region.US_EAST_1)
56+
.build();
5357

5458
createEndpoint(snsClient, token, platformApplicationArn);
5559
}
56-
5760
public static void createEndpoint(SnsClient snsClient, String token, String platformApplicationArn) {
5861
System.out.println("Creating platform endpoint with token " + token);
5962
try {
6063
CreatePlatformEndpointRequest endpointRequest = CreatePlatformEndpointRequest.builder()
61-
.token(token)
62-
.platformApplicationArn(platformApplicationArn)
63-
.build();
64+
.token(token)
65+
.platformApplicationArn(platformApplicationArn)
66+
.build();
6467

6568
CreatePlatformEndpointResponse response = snsClient.createPlatformEndpoint(endpointRequest);
6669
System.out.println("The ARN of the endpoint is " + response.endpointArn());
70+
6771
} catch (SnsException e) {
6872
System.err.println(e.awsErrorDetails().errorMessage());
69-
System.exit(1);
7073
}
7174
}
7275
}

0 commit comments

Comments
 (0)