Showing posts with label Must be Server. Show all posts
Showing posts with label Must be Server. Show all posts

Monday, January 28, 2008

"Must be Server" error from PushRegistry with sms

Whew ! Took 2 days to figure this out.

Recently attempted to create a MIDlet which wakes up on SMS using the PushRegistry feature in Java ME.

Kept getting "Must be Server" error at the
mc.receive()
line in following code snippet :


if (url.startsWith("sms://")) {
MessageConnection mc = (MessageConnection) Connector.open(url);
Message msg = mc.receive();
String data = "";

if (msg != null) {
if (msg instanceof TextMessage) {
form.append("TextMessage\n");
data = ((TextMessage)msg).getPayloadText();
}
}
}


Turns out the JAD file of said MIDlet has the following incorrectly typed PushRegistry entry :


MIDlet-Push-1: sms://8033, org.whatever.Poink, *


There should be a ":" after the 2 "slashes" like so :


MIDlet-Push-1: sms://:8033, org.whatever.Poink, *


After the above fix, the "Must be Server" disappeared :)