Receive SMS messages with NowSMS

Receive SMS messages with NowSMS SearchSearch
Author Message
barbara
New member
Username: Bee_pu

Post Number: 1
Registered: 11-2009
Posted on Saturday, November 14, 2009 - 05:05 pm:   

Hello!
I have some problems with receiving SMS messages. First, does Nokia 6650 fold (Symbian OS) support receiving SMS? And Nokia 6288 (not Symbian OS)?
Can you explain me a little bit what is exactly receiving SMS with NowSMS? Does it means that someone send me an SMS to my phone, and than I receive it in some files in NowSMS? Do I have to know who will send me a SMS and register that number in NowSMS configuration somewhere?Where can I see that the message is received? I have some project to work on, where I must receive some SMS message and then analize it (string text) in Java, so I don't have any idea how to combinate NowSMS and Java, how can i receive a text message and then analize text from it? Then, I don't really understand the configuration that I must do (SMS command prefix, command to execute..) - can you explain to me not with expert language, please?
The biggest problem is this with Java, so please help me.
regard and many thanks,
B.
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 1429
Registered: 08-2008
Posted on Monday, November 16, 2009 - 04:49 pm:   

Hi Barbara,

Nokia phones that use the S60 (Series 60) interface, which is Symbian based, only support sending SMS messages via the modem interface, and do not support receiving SMS via the modem interface. Nokia phones using the Series 40 3rd Generation (2005) or later interface have similar limitations and do not support receiving SMS via the modem interface.

Unfortunately, This makes most Nokia phones incompatible with the 2-way SMS functionality of NowSMS.

These days dedicated GSM modem devices are more widely available, so we tend to recommend them over using a mobile phone as a modem for most applications. More details and information can be found at: http://www.nowsms.com/support/GSMModem.htm

On to your other questions:


quote:

Can you explain me a little bit what is exactly receiving SMS with NowSMS? Does it means that someone send me an SMS to my phone, and than I receive it in some files in NowSMS?




Yes.

While it is possible for you to process the messages as files, it is more common that NowSMS passes the message details to your application as command parameters.

In the context of Java, you'd have a Java servlet running somewhere. NowSMS would connect to the servlet via a URL, and it would pass the received message details as URL parameters.


quote:

Do I have to know who will send me a SMS and register that number in NowSMS configuration somewhere?




No.


quote:

Where can I see that the message is received?




If you do not have any 2-way commands defined, received messages will be stored as files in the SMS-IN directory. There is also a "View" button on the "2-way" page that will show a list of these received messages.

If you have 2-way commands defined, the messages are passed to those commands, and they are deleted automatically after the command has processed the message.

In either case, the received messages are also logged in the SMSIN-yyyymmdd.LOG file.


quote:

I have some project to work on, where I must receive some SMS message and then analize it (string text) in Java, so I don't have any idea how to combinate NowSMS and Java, how can i receive a text message and then analize text from it?




You configure a 2-way command in NowSMS.

This command can either be a local command (something you would run from a command prompt window), or an HTTP URL.

When you define your command to NowSMS, there are replaceable parameters settings to indicate where NowSMS should insert the message details.

For example, let's say you define a command http://server/path/app?sender=@@SENDER@@&text=@@FULLSMS@@ ...

NowSMS receives a message from +44777777777 with text "this is a test".

NowSMS connects to the following URL:

http://server/path/app?sender=%2B44777777777&text=this%20is%20a%20test

The "%xx" are standard URL escaping. Most development environments that process HTTP URL parameters automatically decode the parameters so you don't have to worry about the decoding. In a Java servlet, you would use request.getParameter("sender") to retrieve the sender address from the above URL.


quote:

Then, I don't really understand the configuration that I must do (SMS command prefix, command to execute..) - can you explain to me not with expert language, please?




Put "*" in the "SMS Command Prefix", this is a wildcard that means that all received messages will be routed to your command.

"Command to Execute" is your command ... a local command line command, or an HTTP URL. Hopefully I described this in sufficient detail above.

--
Des
NowSMS Support
barbara
New member
Username: Bee_pu

Post Number: 2
Registered: 11-2009
Posted on Monday, November 16, 2009 - 05:01 pm:   

Thanks a lot, I'll try it.
barbara
New member
Username: Bee_pu

Post Number: 3
Registered: 11-2009
Posted on Monday, November 16, 2009 - 05:06 pm:   

I have one more question- do I have to have an Java servlet, I don't know to work with these things, I'm a student, I just have to analize received message in Eclipse platform, in Java language. Can I do something less complicated then this with HTTP URL and Java servlet..?
Sorry for my not so good english..
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 1435
Registered: 08-2008
Posted on Monday, November 16, 2009 - 09:59 pm:   

Yes.

In that case, you need to write your Java program so that it can be run from a command line prompt.

I wouldn't even try to interface it with NowSMS until you had the basics in place.

By basics, I mean a Java application that you can run from a command line prompt, passing it command line parameters similar to what NowSMS would pass.

Let's say the Java application is called ReceiveSMS.

You're going to design the application to accept the sender phone number and the message text.

The eventual NowSMS command would be:

c:\path\java.exe ReceiveSMS "@@SENDER@@" "@@FULLSMS@@"

NowSMS receives a message from +44777777777 with text "this is a test".

NowSMS spawns the following command:

c:\path\java.exe ReceiveSMS "+44777777777" "this is a test"

Your application parses the command line arguments for the message details. I put "quotes" around the arguments, because this ensures that if there is a space in the argument, Java sees it all as a single argument.

I've never written this type of Java application before, but the way I understand it, args[0] would contain the sender address, and args[1] would contain the message text in this example.

--
Des
NowSMS Support
barbara
New member
Username: Bee_pu

Post Number: 4
Registered: 11-2009
Posted on Tuesday, November 17, 2009 - 10:50 am:   

Many thanks,
regards from Croatia,
Barbara
barbara
New member
Username: Bee_pu

Post Number: 5
Registered: 11-2009
Posted on Thursday, December 10, 2009 - 12:51 pm:   

I have some problems with this. Now, when I finally found a mobile to work with received SMS, it doesn't work with command line! I don't know what to put at this path you told me (c:\path\java.exe ReceiveSMS "@@SENDER@@" "@@FULLSMS@@") .. what should I put there? I don't know which path do I use? Maybe path to class ReceiveSMS ("bin" folder where ReceiveSMS.class is?)
Then, when the SMS is received, how can I connect command line prompt where are arguments passed, and Eclipse where I analize text message? (I have several classes in Eclipse, so I must somehow connect command line prompt and working in eclipse)..
can you please help me, if you know ! I never done anything like this, and I must finish this things very soon because I will not get a positive pass on college.
thank you very much
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 1534
Registered: 08-2008
Posted on Thursday, December 10, 2009 - 02:20 pm:   

Hi Barbara,

If you open a command line window and your current directory is \Program Files\NowSMS, what command line would you have to type to run the program?

It will be easier to troubleshoot that way, then once you have it working configure it in NowSMS.

-- Des
barbara
New member
Username: Bee_pu

Post Number: 6
Registered: 11-2009
Posted on Thursday, December 10, 2009 - 02:59 pm:   

Hm.. when I'm in command line window in directory Program Files\NowSMS, I can not run my java program. because it is in another directory - Program Files\Users\Barbara\Java workspace\.... so I must be in that directory,and then call command "java ClassName", to run it.
I don't actually understand what should I type in "command to execute" field in NowSMS. is it path to my java program (called for ex.ReceiveSMS.class, in "bin" folder)?
I just must analize text from received SMS message in some class in Eclipse. That's it..
barbara
New member
Username: Bee_pu

Post Number: 7
Registered: 11-2009
Posted on Thursday, December 10, 2009 - 06:43 pm:   

I have my Eclipse project in some defined workspace, so my command to execute in NowSMS was: C:\Windows\System32\cmd.exe /c java C:\Users\Barbara\Desktop\JavaWorkSpace\Receive2 @@SENDER@@ @@FULLSMS@@

Is it correct command? In which directory I should be? Where is CLASS file, or JAVA file?

I want to execute Receive2 class, with those 2 arguments (sender, fullsms), so that I could analize it.
barbara
New member
Username: Bee_pu

Post Number: 8
Registered: 11-2009
Posted on Friday, December 11, 2009 - 10:24 am:   

I tryed this:
Command to execute :
C:\Windows\System32\cmd.exe /c java C:\Users\Barbara\Desktop\JavaWorkSpace\Receive2\bin\Receive2.class @@SENDER@@ @@FULLSMS@@

When someone sends me a SMS, nothing happens, except comming SMS to my mobile phone, and lots of SMS messages back to sender. This messages are also in Log Files (SMS-IN)- I copied them, so you can see it down.Those messages came back to sender when he sends SMS to my mobile which is connected via Bluetooth.
Also, my questions above are still important, I don't know how to solve this.
Here are messages that some to sender and in SMS-IN folder:

2009-12-11 11:16:21,+385989612444,Standard Modem over Bluetooth link #5,DCS=8;UDH=050003CB0C01;Text="java.lang.NoClassDefFoundError: C:\Users\Barbara\Desktop\JavaWorkSp"
2009-12-11 11:16:35,+385989612444,Standard Modem over Bluetooth link #5,DCS=8;UDH=050003CB0C0A;Text="n Source)
Could not find the main class: C:\Users\Barbara\Desktop\"
2009-12-11 11:16:35,+385989612444,Standard Modem over Bluetooth link #5,DCS=8;UDH=050003CB0C0B;Text="JavaWorkSpace\Receive2\bin\Receive2.class. Program will exit.
Exc"
2009-12-11 11:16:50,+385989612444,Standard Modem over Bluetooth link #5,DCS=8;UDH=050003CB0C0C;Text="eption in thread "main" "
2009-12-11 11:16:50,+385989612444,Standard Modem over Bluetooth link #5,DCS=8;UDH=050003CB0C02;Text="ace\Receive2\bin\Receive2/class
Caused by: java.lang.ClassNotFound"
2009-12-11 11:16:51,+385989612444,Standard Modem over Bluetooth link #5,DCS=8;UDH=050003CB0C03;Text="Exception: C:\Users\Barbara\Desktop\JavaWorkSpace\Receive2\bin\Rece"
2009-12-11 11:17:06,+385989612444,Standard Modem over Bluetooth link #5,DCS=8;UDH=050003CB0C04;Text="ive2.class
at java.net.URLClassLoader$1.run(Unknown Source)
at "
2009-12-11 11:17:06,+385989612444,Standard Modem over Bluetooth link #5,DCS=8;UDH=050003CB0C05;Text="java.security.AccessController.doPrivileged(Nati ve Method)
at jav"
2009-12-11 11:17:20,+385989612444,Standard Modem over Bluetooth link #5,DCS=8;UDH=050003CB0C06;Text="a.net.URLClassLoader.findClass(Unknown Source)
at java.lang.Class"
2009-12-11 11:17:20,+385989612444,Standard Modem over Bluetooth link #5,DCS=8;UDH=050003CB0C07;Text="Loader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoa"
2009-12-11 11:17:34,+385989612444,Standard Modem over Bluetooth link #5,DCS=8;UDH=050003CB0C08;Text="der.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass("
2009-12-11 11:17:34,+385989612444,Standard Modem over Bluetooth link #5,DCS=8;UDH=050003CB0C09;Text="Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknow"
barbara
New member
Username: Bee_pu

Post Number: 9
Registered: 11-2009
Posted on Friday, December 11, 2009 - 10:28 am:   

I forgot to say, project is in workpace
C:\Users\Barbara\Desktop\JavaWorkSpace\Receive2
(there are bin and src folders)
when I have NowSMS turned off, in command prompt I successfully start program (javac Receive2.class, and then java Receive2 arg0 arg1)
barbara
New member
Username: Bee_pu

Post Number: 10
Registered: 11-2009
Posted on Friday, December 11, 2009 - 07:43 pm:   

Ok, I solved problem- I think I solved it..
so, my command to execute is
C:\Windows\System32\cmd.exe /c java -classpath C:\Users\Barbara\Desktop\JavaWorkSpace\Receive2\src "@@SENDER@@" "@@FULLSMS@@"

My new question is: when the SMS is received, I get it on my mobile phone from +4777777 with text "text". What happens?Sender gets back SMS message with text like this: arg(0)=+47777777, arg(1)="text", but command prompt doesn't do anything (it is turned on all the time).
Why sender gets back this message? Those arguments I should analize, but in command prompt they do not show, nothing, nothing happens! just SMS to sender back with arguments!Do you know why?
Des - NowSMS Support
Board Administrator
Username: Desosms

Post Number: 1538
Registered: 08-2008
Posted on Saturday, December 12, 2009 - 02:00 pm:   

Is that what your program echoes back to the screen in normal operation?

If "Command returns response text" is checked the NowSMS traps screen output and routes it as a reply to the original sender.

-- Des