English 中文(简体)
J2ME SMS Server on mobile phone
原标题:

Is it possible to have a j2me app on a mobile to act as a "SMS gateway" that will handle incommming messages, do a query on a database via GPRS and reply the user back?

问题回答

This is entirely possible on any J2ME handset that supports JSR 120 (i.e.: most of them). However as Wonil said, you can t just process ANY incoming SMS message. It has to be an SMS sent to a port number on which your app is listening (using a server connection as Wonil explained).

It wouldn t be automatic unless the app was signed (as confirmation is generally required for sending SMS and network access).

Another approach is to tether your phone to a PC using a USB cable/bluetooth/IR, open a serial connection using the phone as a modem, and write a program to listen for new SMSs using AT+CGML as described here. This would allow ANY incoming SMS to be processed (no port number required), and without any annoying confirmation prompts.

HTH

I think you should check about JSR-120 documentation to confirm. But, in my thought it might be impossible. If you want to receive message by using JSR-120, you should assign specific end point(port number) to listen as like below:

serverConn = (MessageConnection)Connector.open("sms://:5000");

So, you can t catch all SMS messages. It can t be a gateway then.

It probably depends if your phone supports it. Have a look at the J2ME Wireless Messaging API:

The Wireless Messaging API (WMA) is an optional package for the Java 2 Platform, Mobile Edition (J2ME) that provides platform-independent access to wireless communication resources like Short Message Service (SMS).

http://java.sun.com/products/wma/overview.html

This article has some examples which can probably serve as a starting point for what you want to achieve: http://www.ibm.com/developerworks/wireless/library/wi-extendj2me/

Edit: as others have pointed out, you might not be able to receive all messages.





相关问题
add text in http request string url

ok i made a midlet through which i can connect to server pages and get soem information as response. For example i made a midlet through which i acced url: http://example.com/?u=nepal&t=1 Now i ...

Do I have to do a setSize() on a Vector before using it?

Given private final Vector v = new Vector(); //instance variable the following 3 lines are in an instance method in the same class. 1. int length = v.capacity(); 2. int size = v.size(); ...

Is the situation with Java ME improving?

It seems to be the consensus that developing for Java ME is not as cross platform as you might expect, particularly compared to say java SE, but it is difficult to assess how the situation is evolving....

Privileged operations in netbeans mobility

I m writing a Java ME app that will use privileged operations such as messaging. By default the user is prompted to confirm each of these operations, but I would like to run it as a background ...

ClassFormatError: 56 while using hessian in j2me

I am trying to use the hessian j2me implementation @ http://hessian.caucho.com/ using java me sdk 3.0. http://hessian.caucho.com/doc/hessian-overview.xtp#Hessian%20Client%20for%20a%20cell-phone ...

热门标签