views:

1067

answers:

1

I am configuring my J2ME app to get an event from the push registry on receipt of an SMS. Would I be able to access the SMS message, before it reaches the inbox? I have read that messages sent to port0 of the mobile go directly to native inbox and we can't access it. Is there any way of diverting or even sniffing these messages so as to perform an operation on them from within the J2ME app.

+5  A: 

According to this discussion, it is not possible to receive a SMS on port 0 using a MIDlet before it enters the inbox. And while I am not familiar with the Wireless Messaging API, various other posts seems to indicate that you cannot access the inbox either (I might be wrong on this).

What I think you could do instead is to open a serial connection to the modem part of the phone and listen for an UR code (Unsolicited Response, "events") indicating that a new SMS is arrived, read it and if it matches your criteria delete it (from the inbox, you still have your copy) using AT commands. See the AT+CNMA command (New Message Acknowledgement) and similar in the standard (most mobile phone AT commands are by the way specified in 27.007).


For the following I have no idea if if even makes sense/is possible. I only mention it for completeness.

As for processing the SMS before it arrives in the inbox I think the only option (without it having being sent to a specific port that you listen for) is SIM application toolkit (which can do a hell of a lot of things), although that is way outside the scope of J2ME and highly obscure and highly un-trivial. Only follow this route if you are really, really desperate.

hlovdal
nice exhaustive reply! I have read that I can receive sms on another port(other than the default 0) in J2ME. Even so I will try out the serial port method that you have put forth.SIM application toolkit was an eyeopener.
Kevin Boyd