-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.java
59 lines (41 loc) · 1.49 KB
/
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/**
Import SMSLinkSMSGateway class from SMSLink package located in SMSLinkSMSGateway.java file
Requires org.json package
*/
import SMSLink.SMSLinkSMSGateway;
class Main {
public static void main(String[] args) {
System.out.println("Sending SMS from My Java Application ...");
/**
Get your SMSLink / SMS Gateway Connection ID and Password from
https://www.smslink.ro/get-api-key/
*/
/**
Initialize SMSLinkSMSGateway class as SMSLinkInstance
*/
SMSLinkSMSGateway SMSLinkInstance = new SMSLinkSMSGateway("MyConnectionID", "MyConnectionPassword");
/**
Enable Logging (logging is disabled by default)
You may disable logging also by using SMSLinkInstance.disableLogging();
*/
SMSLinkInstance.enableLogging();
/**
Send SMS #1
*/
String messageID = SMSLinkInstance.sendMessage("07xyzzzzzz", "This is my first hello world message!");
if (messageID != null)
System.out.println("Message #1 sent with Message ID: " + messageID + "!");
/**
Send SMS #2
*/
messageID = SMSLinkInstance.sendMessage("07xyzzzzzz", "This is my second hello world message!");
if (messageID != null)
System.out.println("Message #2 sent with Message ID: " + messageID + "!");
/**
Request Account Balance
*/
String accountBalance = SMSLinkInstance.accountBalance();
System.out.println(accountBalance);
System.out.println("Done sending SMS from My Java Application.");
}
}