File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
src/main/java/io/ably/tutorial Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -6,5 +6,5 @@ repositories {
6
6
}
7
7
8
8
dependencies {
9
+ compile ' io.ably:ably-java:0.8.+'
9
10
}
10
-
Original file line number Diff line number Diff line change
1
+ package io .ably .tutorial ;
2
+
3
+ import io .ably .lib .rest .AblyRest ;
4
+ import io .ably .lib .types .AblyException ;
5
+
6
+ public class Example {
7
+
8
+ private final static String API_KEY = "INSERT-YOUR-API-KEY-HERE" ; /* Sign up at ably.io to get your API key */
9
+
10
+ /* RuntimeException will be thrown if API_KEY will not be set to a proper one */
11
+ static {
12
+ if (API_KEY .contains ("INSERT" )) {
13
+ throw new RuntimeException ("API key is not set, sign up on ably.io to get yours" );
14
+ }
15
+ }
16
+
17
+ public static void main (String [] args ) {
18
+ try {
19
+ initAbly ();
20
+ } catch (AblyException e ) {
21
+ e .printStackTrace ();
22
+ }
23
+ }
24
+
25
+ /* Add AblyException to method signature as AblyRest constructor can throw one */
26
+ private static void initAbly () throws AblyException {
27
+ AblyRest ablyRest = new AblyRest (API_KEY );
28
+ }
29
+ }
You can’t perform that action at this time.
0 commit comments