Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 551
Registered: ‎10-31-2009
My Device: Torch 9800, Bold 9700

Question on J2ME Midlet

[ Edited ]

I have an application running on a Symbian platform using a J2ME Midlet that communicates with a native application using TCP as a communication platform. Having read about communication between applications on Blackberry  I understand that loopback communication is not supported on Blackberry. In other words, the J2ME Midlet is not fully supported on the Blackberry platform?

 

From Wikipedia: ( http://wiki.forum.nokia.com/index.php/MIDletNativeServicesFramework )

<snip

 

Just as a MIDlet can communicate with applications running on remote hosts using standard communications protocols, so a MIDlet running on Symbian OS can communicate with another application running on the same host using the local loop back address (127.0.0.1).

 

<end snip

If everything seems to be under control, you're just not driving fast enough
-Mario Andretti-
Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Question on J2ME Midlet

I don't think J2ME mandates the ability of MIDlets to communicate with each other via the loopback interface.

 

You could try the dirty and evil solution of clients and servers on the same device communicating via the cellular or WiFi interface: http://supportforums.blackberry.com/t5/Java-Development/Is-it-possible-to-create-a-server-socket/m-p... The catch is it only works if the BlackBerry has an IP tunnel to the carrier or if it's connected to a WLAN.

Developer
Posts: 551
Registered: ‎10-31-2009
My Device: Torch 9800, Bold 9700

Re: Question on J2ME Midlet

Thanks klyubin but as you say "the dirty and evil solution" is not really a viable solution.

The J2ME Midlet was designed to be a sort of minimum platform accepted by all. And it does support

"initernal" communication.

If everything seems to be under control, you're just not driving fast enough
-Mario Andretti-
Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Question on J2ME Midlet

[ Edited ]

I can't find any reference to localhost/loopback connections in CLDC-1.1 (http://jcp.org/aboutJava/communityprocess/final/jsr139/) or MIDP-2.0 (http://jcp.org/aboutJava/communityprocess/final/jsr118/index.html) specifications. Sorry, I don't want to sound like a nag, but if you can point to the references, then we can make a better case to RIM to support local connections.

Developer
Posts: 551
Registered: ‎10-31-2009
My Device: Torch 9800, Bold 9700

Re: Question on J2ME Midlet

Thanks klyubin

 

I will check back on the original creator of the midlet if it is something that Symbian has added just for their platform. It works on the symbian

If everything seems to be under control, you're just not driving fast enough
-Mario Andretti-
Developer
Posts: 551
Registered: ‎10-31-2009
My Device: Torch 9800, Bold 9700

Re: Question on J2ME Midlet

The midlet in question is developed with Borland JBuilder. If the developer would like to incorporate code to have an alternate way of communicating to Blackberry via Global Events when talking to a Blackberry phone instead of using TCP (which is the way to talk to a Nokia Symbian) I assume this can be done.

 

The questions then are:

 

 - How to identify that the phone is Backberry not a Symbian?

 - What has to be imported to get the functionality for Global Events?

If everything seems to be under control, you're just not driving fast enough
-Mario Andretti-
Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Question on J2ME Midlet

The most straightforward and powerful way would be to build the application for BlackBerry as a RIMlet (i.e., conventional BlackBerry Java application instead of a MIDlet). In this case you'll get access to all the necessary APIs.

Developer
Posts: 551
Registered: ‎10-31-2009
My Device: Torch 9800, Bold 9700

Re: Question on J2ME Midlet

The application developer of the midlet wants to keep just one general version. The whole purpose of using a midlet for the main application is to be as general as possible in order to keep the customisation for all different brands of hardware to the minimum. Starting point was Symbian hence the TCP communication vehicle. Obviously Symbian supports internal TCP communication since the application works for Nokia. There are some more hardware close functionality that is written in Symbian native code and that is the code I have to develop for Blackberry and another person for Windows mobile. One of the functions is to listen to the occurrence of outgoing calls so the midlet and the function code are  running in separate threads and need to communicate with each other.

 

So I guess its a trial and error approach trying to incorporate blackberry API code to the existing midlet   

If everything seems to be under control, you're just not driving fast enough
-Mario Andretti-
Developer
Posts: 1,474
Registered: ‎04-14-2009
My Device: Not Specified

Re: Question on J2ME Midlet

[ Edited ]

No, it's not a trial error approach. It's pretty straightforward: either you build a MIDlet which is limited to CLDC and MIDP APIs, or build a RIMlet and can use all BlackBerry APIs. You can do some trickerly, like building an additional library module containing classes that you can instantiate by name using reflection from your MIDlet, but I doubt that you'll be able to solve your issue with one MIDlet only.

 

P.S. If CLDC/MIDP let you instantiate a MIDlet on demand, then your main MIDlet could register the PhoneListener which will instantiate a new MIDlet every time a call comes in.

New Developer
Posts: 17
Registered: ‎05-01-2009
My Device: Not Specified

Re: Question on J2ME Midlet

I am bumping up against this limitation as well.  Desperately want a loopback for MIDlets on the Blackberry, but no luck.  I think it's becuase the "localhost" address ranges are used by the enterprise backbone.

 

So, I'm looking at writing a RIM application that will use GlobalEvents.

 

That I know of, the J2ME specifications are silent on the loopback question.  I think it's just generally assumed that loopback would be there somehow.  But, I don't think it's required, so RIM takes advantage of it....

 

Makes sense in a way, but I wish RIM was better with the documentation explaining this....

 

 

Richard