Results 1 to 12 of 12
- 04-02-2008, 09:55 AM #1
Member
- Join Date
- Mar 2008
- Posts
- 2
- Rep Power
- 0
- 04-02-2008, 10:46 AM #2
A simple Google search will be able to provide you with some answers:
Simplewire : Java SMS SDK
How to Send SMS using Java Program (full code sample included)
In future, please post a more detailed explanation of your requirements.Did this post help you? Please
me! :cool:
- 04-02-2008, 12:00 PM #3
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Yes it is, in Google is one of the best solution to find the such details. Can find lots of resources there.
- 11-27-2008, 04:46 PM #4
Member
- Join Date
- Nov 2008
- Posts
- 1
- Rep Power
- 0
Prasad
Hi I am new to this forum.i need help sendins sms fax/email actions using java Application.Pls suggest me.
Thanks,Prasad
- 11-28-2008, 04:10 AM #5
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 12-27-2008, 12:46 PM #6
Member
- Join Date
- Dec 2008
- Posts
- 1
- Rep Power
- 0
tanx for giving d stuff
- 01-01-2009, 02:58 AM #7
Member
- Join Date
- Jan 2009
- Posts
- 2
- Rep Power
- 0
Send and Recevie SMS using Java
Hi,
Here is a sample code in Java for sending and receiving SMS:-
Source: mobitek.com.my/SMS_Gateway/SMS_API_Java/Index.htmJava Code:package javaSMS; import com.jacob.activeX.*; import com.jacob.com.*; public class javaSMSTest { //extract "return value" as boolean, integer and assign to these variables:- private static boolean bSMS; private static int iSMS; /** * @param args */ public static void main(String[] args) { //construct an object -- "SMSAPIJava", a Java wrapper for SMS class in "MobitekSMSAPI5.dll" ActiveXComponent SMSAPIJava = new ActiveXComponent ("MobitekSMSAPI5.SMS"); //&&&&&&&&&& connect GSM modem to computer &&&&&&&&&&&&&&&&&& //call API to connect GSM modem to computer at COM port no. 2 //the return value of the API call is assigned to "SMSAPIReturnValue" Variant SMSAPIReturnValue = SMSAPIJava.invoke("ModemInit", 2); //since the return value of function "ModemInit" is an integer, so extract the return value as an integer and assign to "iSMS" iSMS = SMSAPIReturnValue.getInt(); switch (iSMS) { case 0 : System.out.println("GSM modem is NOT connected to computer!"); return; case 1 : System.out.println("GSM modem is connected to computer."); break; case 2 : System.out.println("GSM modem is NOT connected to computer because a PIN is required!"); return; case 3 : System.out.println("GSM modem is NOT connected to computer because wrong PIN is entered!"); return; case 4 : System.out.println("GSM modem is NOT connected to computer because SIM card is blocked by network operator!"); return; case 5 : System.out.println("GSM modem is NOT connected to computer because SIM card has problem!"); return; } //&&&&&&&&&& end: connect GSM modem to computer &&&&&&&&&&&&&&&&&& //!!!!!!!!!! check connection between GSM modem and GSM network !!!!!!!!!!!!!!!!!!!!!!!! //call API to check connection with GSM network, the return value of the API call is assigned to "SMSAPIReturnValue" SMSAPIReturnValue = SMSAPIJava.invoke("ConnectToGSM"); //since the return value of "ConnectToGSM" is a boolean, so extract the return value as a boolean and assign to "bSMS" bSMS = SMSAPIReturnValue.getBoolean(); if (bSMS) { System.out.println("GSM modem is connected to GSM network."); } else { System.out.println("GSM modem is NOT connected to GSM network!"); } //!!!!!!!!!! end: check connection between GSM modem and GSM network !!!!!!!!!!!!!!!!!!!!!!!! //~~~~~~~~~~~~~~~~ check signal strength of GSM network ~~~~~~~~~~~~~~~~~~~~~~~ //call API to check signal strength of GSM network, the return value of the API call is assigned to "SMSAPIReturnValue" SMSAPIReturnValue = SMSAPIJava.invoke("GetSignalStrength"); //since the return value of "GetSignalStrength" is an integer, so extract the return value as an integer and assign to "iSMS" iSMS = SMSAPIReturnValue.getInt(); switch (iSMS) { case -1 : System.out.println("Unable to get signal strength!"); break; case 0 : System.out.println("NO signal strength!"); break; case 1 : System.out.println("WEAK signal strength."); break; case 2 : System.out.println("NORMAL signal strength."); break; case 3 : System.out.println("STRONG signal strength."); break; } //~~~~~~~~~~~~~~~~ end: check signal strength of GSM networki ~~~~~~~~~~~~~~~~~~~~~~~ //########### turn delivery status report on ####################### //call API to turn delivery status report on //the return value of the API call is assigned to "SMSAPIReturnValue" SMSAPIReturnValue = SMSAPIJava.invoke("DeliveryReportOn"); //since the return value of "DeliveryReportOn" is a boolean, so extract the return value as a boolean and assign to "bSMS" bSMS = SMSAPIReturnValue.getBoolean(); if (bSMS) { System.out.println("Delivery status report is turned on."); } else { System.out.println("Delivery status report is NOT turned on!"); } //########### end: turn delivery status report on ####################### //------------------ send SMS ---------------------------------------- //set value of property; "ToNumber" is the recipient's number; "ToMessage" is the SMS to be send to the recipient SMSAPIJava.setProperty("ToNumber", "0163311600"); SMSAPIJava.setProperty("ToMessage", "Hello from JAVA. Test DSR 6"); //call API to send out SMS, the return value of the API call is assigned to "SMSAPIReturnValue" SMSAPIReturnValue = SMSAPIJava.invoke("SendSMS"); //since the return value of "SendSMS" is a boolean, so extract the return value as a boolean and assign to "bSMS" bSMS = SMSAPIReturnValue.getBoolean(); if (bSMS) { System.out.println("Messange sent!"); //try 3 times for (int i=1; i<=3; i++) { //call API to get delivery status report, the return value of the API call is assigned to "SMSAPIReturnValue" SMSAPIReturnValue = SMSAPIJava.invoke("GetDeliveryReport"); //since the return value of "GetDeliveryStatusReport" is a boolean, so extract the return value as a boolean and assign to "bSMS" bSMS = SMSAPIReturnValue.getBoolean(); if (bSMS) { //when "GetDeluveryStatusReport = True", then get value of properties int DRStatus = SMSAPIJava.getPropertyAsInt("DRStatus"); String DRMNRecipient = SMSAPIJava.getPropertyAsString("DRMNRecipient"); String DRMsgRef = SMSAPIJava.getPropertyAsString("DRMsgRef"); String DRFDate = SMSAPIJava.getPropertyAsString("DRFDate"); String DRFTime = SMSAPIJava.getPropertyAsString("DRFTime"); String DRRDate = SMSAPIJava.getPropertyAsString("DRRDate"); String DRRTime = SMSAPIJava.getPropertyAsString("DRRTime"); if (DRStatus == 1) { //System.out.println("The status of your outgoing SMS with reference number, " + DRMsgRef + ", is " + DRStatus + "."); System.out.println("The status of your outgoing SMS with reference number, " + DRMsgRef + ", is delivered."); System.out.println("Your outgoing SMS was received by the SMS Centre on " + DRRDate + ", at " + DRRTime + ", and was successfully delivered to " + DRMNRecipient + ", on " + DRFDate + ", at " + DRFTime + "."); } else if (DRStatus == 0) { //System.out.println("The status of your outgoing SMS with reference number, " + DRMsgRef + ", is " + DRStatus + "."); System.out.println("The status of your outgoing SMS with reference number, " + DRMsgRef + ", is not delivered."); System.out.println("Your outgoing SMS was received by the SMS Centre on " + DRRDate + ", at " + DRRTime + ", and was NOT successfully delivered to " + DRMNRecipient + "."); } else if (DRStatus == 2) { //System.out.println("The status of your outgoing SMS with reference number, " + DRMsgRef + ", is " + DRStatus + "."); System.out.println("The status of your outgoing SMS with reference number, " + DRMsgRef + ", is unknown."); System.out.println("Your outgoing SMS was received by the SMS Centre on " + DRRDate + ", at " + DRRTime + ", and NO status is available."); } break; } else { System.out.println("No delivery status report available!"); } } } else { System.out.println("Messange NOT sent!"); } //------------------ end: send SMS ---------------------------------------- //+++++++++++++++++++++ read SMS ++++++++++++++++++++++++++ //call API to read incoming SMS, the return value of the API call is assigned to "SMSAPIReturnValue" SMSAPIReturnValue = SMSAPIJava.invoke("ReadSMS"); //since the return value of "ReadSMS" is a boolean, so extract the return value as a boolean and assign to "bSMS" bSMS = SMSAPIReturnValue.getBoolean(); //if there is new SMS, then get property if (bSMS) { //property "MN" is the sender's number String InNumber = SMSAPIJava.getPropertyAsString("MN"); //property "MSG" is the sender's message String InMessage = SMSAPIJava.getPropertyAsString("MSG"); System.out.println("Number " + InNumber + ": " + InMessage ); } else { System.out.println("No incoming SMS!"); } //+++++++++++++++++++++ end: read SMS ++++++++++++++++++++++++++ //------- close connection between GSM modem and computer --------------- //call API to close connection between GSM modem and computer, the return value of the API call is assigned to "SMSAPIReturnValue" SMSAPIReturnValue = SMSAPIJava.invoke("ModemClose"); //since the return value of "ModemClose" is a boolean, so extract the return value as a boolean and assign to "bSMS" bSMS = SMSAPIReturnValue.getBoolean(); if (bSMS) System.out.println("Connection between GSM modem and computer is closed." ); else System.out.println("Connection between GSM modem and computer CANNOT be closed!" ); } //------- end: close connection between GSM modem and computer --------------- }
Hope it helps!
Happy coding!Last edited by Helper; 01-01-2009 at 03:07 AM.
- 01-01-2009, 03:06 AM #8
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
I think it's better if you can provide download link of that package, since it's not a standard one for JDK. People can get wired with it.
- 04-12-2009, 07:28 PM #9
Member
- Join Date
- Apr 2009
- Posts
- 1
- Rep Power
- 0
Hi hello this is sandeep.
- 04-13-2009, 12:19 PM #10
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Hello Sandeep, welcome to our community :)
Please don't do this again, if your question is not related to the original of the thread don't post it there. Choose the best sub-forum and start a new thread. And also please read our FAQ page before posting again.
- 09-17-2009, 06:10 AM #11
Member
- Join Date
- Aug 2009
- Posts
- 66
- Rep Power
- 0
- 09-24-2009, 10:22 AM #12
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
So why don't you implement a main method and give a try. I hope you are clear with the code.
Similar Threads
-
Server returned HTTP response code: 500.. i need help
By hardc0d3r in forum Java ServletReplies: 9Last Post: 03-12-2012, 08:08 PM -
how to send SMS using Java API
By sanjeevtarar in forum Advanced JavaReplies: 4Last Post: 09-13-2009, 03:15 PM -
java.io.Exception: Server returned HTTP response code: 403
By navishkumarb in forum Advanced JavaReplies: 1Last Post: 01-05-2008, 01:33 PM -
Send a pic through mail, in java
By lenny in forum Advanced JavaReplies: 1Last Post: 07-25-2007, 02:49 PM -
Server returned HTTP response code: 500
By Heather in forum Java ServletReplies: 1Last Post: 07-09-2007, 04:32 AM


LinkBack URL
About LinkBacks


Bookmarks