@@ -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