2

I am trying to get my cell app to work using the push registry technology.

According to the specs you should be-able to use SOCKETS, DATAGRAMS or SMS.

But I always get an IOException when calling registerConnection() when dynamical registring an Inbound Connection. When trying to register SOCKETS or DATAGRAMS

I not even sure it is possible, cause the web only has working SMS examples.

Any indications would be most appreciated!

Sydwell
  • 4,954
  • 1
  • 33
  • 36
  • 2
    Yeah I've never heard of a J2ME handset supporting PushRegistry for anything other than timed alarms and SMS. – funkybro Jan 17 '11 at 12:59
  • 1
    I have seen handsets that let you autostart MIDlets at phone boot time using static PushRegistry, although that is definitely not standard behavior. You might want to post your source code, the exception stack trace and the handset make and model, just in case. – michael aubert Jan 18 '11 at 19:20

1 Answers1

0

I managed to solve the IOException problem.

The authoritative article http://developers.sun.com/mobility/midp/articles/pushreg/ fails to mention that calls to registerConnection() will most likely fail (as detailed in the question).

but repeat attempts will discover the real port assigned to the device as shown below:

public void run(){
             int failCount = 0;
             String base = "55";
             String temp = "";
             while (failCount <2000) {
                try {
                      temp = "datagram://:" +base + Integer.toString(failCount);
                      PushRegistry.registerConnection(temp, midletClassName, filter);   
                      break;

                } catch (IOException ex) {
                   failCount++;
                   continue;
                } 

            } 

The Jury is still out though as to whether the application will start however!!!

Sydwell
  • 4,954
  • 1
  • 33
  • 36