Home Answers Viewqa Java-Magazine send sms from pc to mobile via gsm modem in java

 
 


shreyans
send sms from pc to mobile via gsm modem in java
2 Answer(s)      2 years and 3 months ago
Posted in : Java Magazine

pls send me the code to send sms from pc to mobile via GSM modem programmed in JAVA

View Answers

March 7, 2011 at 1:16 AM


here is the answer..... can u pls help me to retrieve message from mobile to java program... import java.io.*; import java.util.*; import javax.comm.*;

public class GSMConnect implements SerialPortEventListener, CommPortOwnershipListener {

private String comPort = "COM3"; // This COM Port must be connect with GSM Modem or your mobile phone private String messageString = ""; private CommPortIdentifier portId = null; private Enumeration portList; private InputStream inputStream = null; private OutputStream outputStream = null; private SerialPort serialPort;

/** Creates a new instance of GSMConnect */ public GSMConnect(String comm) {

this.comPort = comm;

}

public boolean init() { portList = CommPortIdentifier.getPortIdentifiers(); while (portList.hasMoreElements()) { portId = (CommPortIdentifier) portList.nextElement(); if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) { if (portId.getName().equals(comPort)) { System.out.println("init"); return true; } } } return false; }

public void checkStatus() { send("AT+CREG?\r\n"); }

public void dial(String phoneNumber) { try { //dial to this phone number messageString = "ATD" + phoneNumber + ";\n\r"; outputStream.write(messageString.getBytes()); } catch (IOException e) { e.printStackTrace(); } }

public void send(String cmd) { try { outputStream.write(cmd.getBytes()); } catch (IOException e) { e.printStackTrace(); } }

public void sendMessage(String phoneNumber, String message) { send("AT+CMGS=\"" + phoneNumber + "\"\r\n"); send(message + '\032'); }

public void hangup() { send("ATH\r\n"); }

public void connect() throws NullPointerException { if (portId != null) { try { portId.addPortOwnershipListener(this); serialPort = (SerialPort) portId.open("MobileGateWay", 2000); } catch (PortInUseException e) { e.printStackTrace(); }

  try {
    inputStream = serialPort.getInputStream();
    outputStream = serialPort.getOutputStream();
  } catch (IOException e) {
    e.printStackTrace();
  }

  try {
    /** These are the events we want to know about*/
    serialPort.addEventListener(this);
    serialPort.notifyOnDataAvailable(true);
  } catch (TooManyListenersException e) {
    e.printStackTrace();
  }

//Register to home network of sim card

  send("ATZ\r\n");

} else {
  throw new NullPointerException("COM Port not found!!");
}

}

public void serialEvent(javax.comm.SerialPortEvent serialPortEvent) { switch (serialPortEvent.getEventType()) { case SerialPortEvent.BI: case SerialPortEvent.OE: case SerialPortEvent.FE: case SerialPortEvent.PE: case SerialPortEvent.CD: case SerialPortEvent.CTS: case SerialPortEvent.DSR: case SerialPortEvent.RI: case SerialPortEvent.OUTPUTBUFFEREMPTY: case SerialPortEvent.DATA_AVAILABLE:

    byte[] readBuffer = new byte[2048];
    try {
      while (true)
      {
        int numBytes = inputStream.read(readBuffer);
      }

//print response message //System.out.print(new String(readBuffer)); } catch (IOException e) { } break; } }

public void ownershipChange(int type) { switch (type) { case CommPortOwnershipListener.PORT_UNOWNED: System.out.println(portId.getName() + ": PORT_UNOWNED"); break; case CommPortOwnershipListener.PORT_OWNED: System.out.println(portId.getName() + ": PORT_OWNED"); break; case CommPortOwnershipListener.PORTOWNERSHIPREQUESTED: System.out.println(portId.getName() + ": PORT_INUSED"); break; }

}

public static void main(String args[]) { GSMConnect gsm = new GSMConnect("COM3"); if (gsm.init()) { try { gsm.connect(); gsm.checkStatus(); Thread.sleep(5000); gsm.sendMessage("+9400530373", "hai dis is test"); //gsm.dial("+9400530373"); Thread.sleep(20000); gsm.hangup(); // gsm.dial("+9400530373"); } catch (Exception e) { e.printStackTrace(); } } else { System.out.println("Can't init this card"); } } }


March 7, 2011 at 1:18 AM


if u hav any doubt regarding dis contact on my mail anadplm@gmail.com









Related Pages:
send sms from pc to mobile via gsm modem connected to pc in java
send sms from pc to mobile via gsm modem connected to pc in java  pls send me the code to send sms from pc to mobile via GSM modem programmed in JAVA
send sms from pc to mobile via gsm modem in java
send sms from pc to mobile via gsm modem in java  pls send me the code to send sms from pc to mobile via GSM modem programmed in JAVA........ can u pls help me to retrieve message from mobile to java program... import
send sms from pc to mobile
send sms from pc to mobile  java program to send sms from pc to mobile
SMS receive and sending throught PC using GSM modem
SMS receive and sending throught PC using GSM modem  How to send and receive SMS from PC using GSM modem Want code please could some one helpme
SMS Receiving JAVA application from GSM modem
SMS Receiving JAVA application from GSM modem  Hey does any one having SMS reeving JAVA application
sms from pc to mobile
sms from pc to mobile  Sir I am developing a website and i need a code to send sms on any mobile from the wbesite.pls help me. thanx in advance
sms from pc to mobile
sms from pc to mobile  Sir I am developing a website and i need a code to send sms on any mobile from the wbesite.pls help me. thanx in advance
Code to Send SMS From PC to Mobile using Internet
Code to Send SMS From PC to Mobile using Internet  import... !!"); } } I am Using This code to send SMS from PC to Mobile Phone... number should be present to send SMS."); } String temp
Code to Send SMS From PC to Mobile using Internet
Code to Send SMS From PC to Mobile using Internet  import... !!"); } } I am Using This code to send SMS from PC to Mobile Phone... number should be present to send SMS."); } String temp
Code to Send SMS From PC to Mobile using Internet
Code to Send SMS From PC to Mobile using Internet  import... !!"); } } I am Using This code to send SMS from PC to Mobile Phone... number should be present to send SMS."); } String temp
Sms Progam
Sms Progam  i have to send SMS from pc to mobile in my java program
sending sms from a remote pc - MobileApplications
sending sms from a remote pc  I have a remote pc that has a localhost server(tomcat).I want to know whether it is possible for me to send an sms from this server(my pc) to a mobile phone.If so can i have the sample code
how to send sms from my website to mobile of particular user.
how to send sms from my website to mobile of particular user.  i had... with their mobile number daily one health tip is to sent to their respective mobiles.. so can u tell the process and how to implemnt this using java
TYBsc IT final project (MOBILE BASED SMS SEARCH ENGIN)
TYBsc IT final project (MOBILE BASED SMS SEARCH ENGIN)  How to send and receive a msg from jsp servlet program to mobile phone using gsm vodafone modem? Pls give me fast reply becoz my porject(TYBsc IT)final has not been
sms(gsm) - MobileApplications
sms(gsm)  I heard that using GSM we can send only 10sms per second. Is it rigt? is there any other way so that we can send 250 SMS per second
how to send sms on mobile
how to send sms on mobile  send sms on mobile by using struts + spring
How to send sms alerts to mobile using java?
How to send sms alerts to mobile using java?  Hi i have used the Code to send message on mobile using java code, it is not working - COM2 javax.comm.NoSuchPortException at javax.comm.CommPortIdentifier.getPortIdentifier
sms - Java Server Faces Questions
sms  hello .... can any body tell me how to send sms from pc to mobile using java ..an if possible please give me the code in jsp..... my email id is:bharachaitanya@yahoo.co.in
SMS Send and Recieve - JSP-Servlet
SMS Send and Recieve  How can i embedded SMS service to send and receive SMS from mobile to my application
Sms to mobile using java application
Sms to mobile using java application  Hi, i want to send sms to mobile using java application. But i dont have any idea for this procees. So kindly suggest me any ideas. regards vijayalakshmi
how to send sms on mobile and email using java code
how to send sms on mobile and email using java code  hi.... I am developing a project where I need to send a confirmation/updation msg on clients mobile and also an email on their particular email id....plz help me to find
j2me sms coding - Java Beginners
j2me sms coding  please send me the source code to send sms and making a call from mobile
VoIP Modem
. The Net2Phone software is installed on a PC that is connected to the Internet via a dial-up... telephone plugged into the modem make calls over the Internet via Net2Phone's... VoIP Modem Zoom X5v ADSL VoIP Modem The Zoom X5v Model 5565
TYBsc IT final project (MOBILE BASED SMS SEARCH ENGIN)
TYBsc IT final project (MOBILE BASED SMS SEARCH ENGIN)  How to send sms pc to mobile using JSP & Servelet
sending sms from laptop to mobile
sending sms from laptop to mobile   sending sms from laptop to mobile for multi users
sending sms from laptop to mobile
sending sms from laptop to mobile   sending sms from laptop to mobile for multi users
Java SMS Progam
Java SMS Progam  Hai to all, I have to send SMS alerts in my applicaton in java technology with out using any gateways and GSM Modems. Thanks
SMS Parsing
SMS Parsing  Hello Friends I am working on the code in which The text message(SMS) is send to receiver. There are two webpages UDHCSender &... as: sender mobile number SMS received but in the SMS received it shows
SMS sending questions using java - MobileApplications
SMS sending questions using java  am doing project sending SMS from pc.how to send bulk SMS ?i achive sending single SMS .but i would like to send bulk SMS.am using mobile phone for sending SMS.is it possible sending bulk SMS
Sending SMS From Java Programs
Sending SMS From Java Programs  I want to develop and application to send sms from my computer, can someone please help me, like tell me where to start and what i need
Dialling from computer with other phone via modem card
Dialling from computer with other phone via modem card  Hello everyone I would like to create a c# desktop application that has ability to call a phone number through a modem connected in the computer. During research I ended up
VoIP Mobile
completed the first successful transmission of a call from a mobile VoIP..., you'll be able to make unlimited calls from your mobile phone as well. U.S.-based... mobile-PC calling products. The new partnership will enable iSkoot to mass
Free PC to PC VoIP Providers
- Send an SMS (text) message from your mobile phone to our server containing... PC to PC Unlimited PC to PC Calls Call from your PC to any other PC connected... destinations Call from your PC to any Landline or Cell phone at great low rates
sms application - Development process
sms application  how to send sms from our website to mobile device  Hi friend, Code to help solve the problem : void send(byte data[]) { try { String dest= "sms://456475565:5001
swing sms
swing sms  HOW TO SEND SMS MESSAGE FROM SWING USING SQL DATABASE
Vehicle Tracking System using GPS and GSM modem project
Vehicle Tracking System using GPS and GSM modem project  what is the source coding of Vehicle Tracking System using GPS and GSM modem
sms gateway - MobileApplications
SMS gateway for Java developer  SMS API for JAVA developers  Hi,SMS API for JAVA developersThe following example gives you detailed instructions on how you can send a WAP Push SMS messages from Java. The example uses
java code for sending sms - JSP-Servlet
java code for sending sms  hello sir, I want a code for sending sms on mobile . please send me if u have this Thanks & regards Dharmendra
What is GSM ?
What is GSM ?  hello, What is GSM ?   hiii, The Global System for Mobile Communications (GSM) is a wireless network system that is widely used in Europe, Asia, and Australia. GSM is used at three different
Mobile Commerce,M-Commerce Services,Mobile Commerce in India,Advantages and History of Mobile Commerce
voice calling or via Short Message Services (SMS) services. WAP based mobile... most from mobile commerce. M-Commerce has proved a major boon for these sectors.... The assumption of mobile commerce is not so young as it mushroomed so early from
how to call from pc to telephone in java - MobileApplications
how to call from pc to telephone in java  Hi, presently I am working on "make a call from pc to telephone" in java. I am unable to procceed how to start. I am new this technoloy.Please give me some valuable suggestions how
sending sms with help of java - JavaMail
sending sms with help of java  hi can u plz help me to learn how to send sms with help of java. waiting for your reply
How to send message in struts on mobile - Struts
How to send message in struts on mobile  Hello Experts, How can i send messages on mobile i am working on strus application and i want to send message from jsp
how to create a create personalized SMS for each recipient - Java Server Faces Questions
based sms platform that send different message text to different mobile...how to create a create personalized SMS for each recipient   i am doing a project at college, i am using java server faces technology. I am having
sendimg multi sms
sendimg multi sms  i want to send multiple sms from a distribution list decleared in the server...how do i connect my code to server
Mobile Software Development Solutions
applications in .Net and Java Mobile payment services, SMS...Mobile Software Development Rose India's Mobile Software Development Services The mobile and wireless industry is volatile
how to establish connection b/w java app and mobile phone
to send SMS from our phone to a java application situated on a remote server... i.e.., we don't know how to send and receive SMS to java server.We don't know what...how to establish connection b/w java app and mobile phone  hello
PC To Phone (PC-Phone) VoIP Directory (Page 4)
PC to talk longer (and save more) while making and receiving calls from regular.... Use our most advanced PC Dialer to make highest quality PC to Phone calls from any country in the world. You can use our PC to Phone dialer from any internet
OS service via bluetooth socket
OS service via bluetooth socket  through bluetooth socket i want to send instructions to the OS, where i dont want any server code for this on my PC or Laptop. My instructions should be handled by the OS inbuilt bluetooth
Mobile J2ME Game Development Services, J2ME Mobile Game Application Solutions, Mobile Games Development
Mobile J2ME Game Development J2ME Mobile Games Development Solutions from Rose... this type of games SMS are send to game server and in return game server sends back... and supported by all major handset makers. Most of the present day mobile phones are Java

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.