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
New Developer
Alfury
Posts: 44
Registered: ‎08-11-2008
My Device: Not Specified

HttpConnection in a j2me application

[ Edited ]

Hi everyone

 

Ive ported an application in j2me which works perfectly in every java enabled device; Rightnow, Im testing in blackberry but Ive got the next problems:

My applications use HttpConnections as well as Bluetooth and other stuff; the problem is, at the simulator, Ive got to run the application, it communicates with internet and make everything in a proper and correct way using MDS.

Now, when I download the application to a real device, The application notices to me about to use the network....then Im not able to change the network permissions to "Yes" when the device prompts to me to use the network; The applications connect to a webservice based in .NET and it has worked perfectly in the simulator so.....where is the problem? the device does not allow to me to change the permission to Yes when it prompts the phone is going to use the network, it just still like frozen and Ive to restart the device because it´s all the time in the network permissions dialog at the beginning of the application; it happens everytime I use one internet operation so I dont really know, either sure what can be happening; Ive read a lot about MDS, BES, etc...but....could anyone tell me if there is anything wrong? Why the applications work perfectly at the simulator and no at the real device? Ive got the APN configured in a proper way; Ive used the ";deviceside=true" in the connection string, Ive made like 1000000 probes about the applications but nothing has worked fine; Ive tried to download the applications via web, via usb but nothing has changed so I dont know what´s wrong; Ive read about if you are not using a BES server, it wont work...is it sure? so....why the applications are working at the simulator? Ive changed the application permissions in Security options to allow everything but at the beginning, it promtps if I want to use the network and keeps frozen being no allowed to change the permissions to "Yes, allow network".Is it a MDS problem? Please Im kinda crazy about this, help me!

 

Kind regards and thx so much in advance

Message Edited by Alfury on 08-11-2008 03:51 AM
Developer
Posts: 62
Registered: ‎07-14-2008
My Device: Not Specified

Re: HttpConnection in a j2me application

Are your JDE and OS versions "fit" to each other?

Is the APN defined in the connection string or in TCP options? 

 

Does the APN of your carrier works for direct TCP connections? I would check that first.

Then I would test it on a BES connected BB device without deviceside parameter.

 

New Developer
Alfury
Posts: 44
Registered: ‎08-11-2008
My Device: Not Specified

Re: HttpConnection in a j2me application

[ Edited ]

Hi again!

 

 

Ive studied the ways to connect via blackberry with the net using a java application; Ive found there are 3 ways, BES, BIS and using the TCP stack; is that correct? Using Tcp stack means the application is going to work not using BES either BIS?

 

Ive checked what you have told to me about the connection String; please can you tell me if use HttpConnection if Ive to include the APN settings? I mean, password, user, etc...?

 

Other question is....how do you mean with "fit" OS and jde version? Ive got a pearl blackberry ( I think it´s the 8100 one ) and Im using JDE 4.3.....the simulators Ive tried are 8120 and 8130....can you help me?

 

UPDATED : Ive looked for the information about the blackberry I own; the blackberry is a 8100 and the platform is v4.2.1.101 so....Does it mean Ive to work with JDE 4.2 and dont use jde 4.3 as Ive done rightnow?? 

 

Thx so much in advance!

Message Edited by Alfury on 08-11-2008 06:41 AM
Developer
Posts: 62
Registered: ‎07-14-2008
My Device: Not Specified

Re: HttpConnection in a j2me application

[ Edited ]

IMHO (it was discussed several times...) I would never put APN settings for TCP connection in the connection string  - in the BB options there is the TCP entry where you can define them. For WAP you have to put them in the connection string.

 

First find out the OS version of your device (options/about) then choose the right JDE version. I guess if you have a not updated Pearl you will need JDE 4.2.1 or even 4.2.0 if the Pearl is older. The alternative is to update your BB to the current OS version (4.5.0)

Message Edited by Ivanov on 08-11-2008 12:43 PM
Message Edited by Ivanov on 08-11-2008 12:44 PM
Developer
Posts: 62
Registered: ‎07-14-2008
My Device: Not Specified

Re: HttpConnection in a j2me application

yes, you need to use JDE 4.2.1 or update to 4.5.0.

 

 

New Developer
Alfury
Posts: 44
Registered: ‎08-11-2008
My Device: Not Specified

Re: HttpConnection in a j2me application

Hi again!

 

 

first of all thx for your response....im downloading the JDE 4.2.0, so Will it work with the 8100 v4.2.1.101?? Why update to the 4.5 version? thx for your fast reply again! 

Developer
Posts: 62
Registered: ‎07-14-2008
My Device: Not Specified

Re: HttpConnection in a j2me application

yes JDE 4.2.0 will work, excepting you are using classes and methods that were introduced in API 4.2.1 and 4.3.0

 

if you update to 4.5 you could use 4.5.0 API. The question is which devices should be supported by your application and which functionality you need...

Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: HttpConnection in a j2me application

Re connection options, you are correct in saying there are three common ways, but these are BES, WAP and Direct.  If you want to investigate some other options, including BIS-B, please review the links in following thread (especially the video).

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&message.id=419

 

If you are using direct connection, you can let the use code the APN settings (in Options-->Advanced-->TCP), or you can code them yourself.  Personally, I try to code them myself because users often get it wrong....

 

With respect your not being able to update the network prompt, I suspect this is a JDE level issue.  However there is one other thing to consider.  I don't know about Midlet applications, but for standard BlackBerry applications, the connection must be a non event thread.  In other words, it must be on a different thread from anything that does any user interaction.  So, for example, initiating a connection directly from code that is being driven from a command key is not allowed.  Is your network code on a distinct thread?

 

New Developer
Alfury
Posts: 44
Registered: ‎08-11-2008
My Device: Not Specified

Re: HttpConnection in a j2me application

Hi again!

 

 

Im downloading the 4.2 version to build the applications so....will it be possible to use HttpConnection? If it´s possible, could you tell me the way to put the correct string to use it in a proper way?

Im using for now :  "http://88.x.x.xxx/.../service.aspx" as the string required to connect....is it possible? thx in advance, kind regards!

New Developer
cstarling
Posts: 7
Registered: ‎08-04-2008
My Device: Not Specified

Re: HttpConnection in a j2me application

@Alfury

 

I also got a frozen Yes/No-prompt on network request because the request takes places after the midlet switch to canvas mode.
Therefore i now making a dummy request direct at programmstart, the Yes/No-prompt can be switched to Yes and all working fine.

 

cstarling