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

New Developer
Posts: 8
Registered: ‎08-21-2008
My Device: Not Specified

Best Practice for postfixing WAP Gateway info for HttpConnection

I have a question about programmatically using the appropriate WAP gateway postfix for URL's. Specifically I'm looking for a best practice for detecting the appropriate network and making a http connection that wont be refused by that particular network.

Issue Background
We're using a HttpConnection to connect to a web service. This works fine for most carriers, but for other we need to provide the appropriate WAPGateway postfix to the URL (As specified in the blackberry article "Different ways to make an HTTP or socket connection" article DB-00396).

Ideally I would like to select the WAP postfix programmatically. Currently we are doing this with the RadioInfo.getNetworkName() method and then doing a compare for the matching network name within an IF-ELSE block that returns the appropriate WAP postfix info. This method is fine, but I feel the solution is a bit fragile and can foresee a lot of issues coming up (i.e. network changes naming convention of its network).

Is there a best practice for assigning the appropriate WAP postfix to a URL prior to making an HTTP connection? I was thinking of using RadioInfo.getNetworkId() but there is no details on what these values map to and if these values are fixed to a specific network.
BlackBerry Development Advisor
Posts: 15,882
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Best Practice for postfixing WAP Gateway info for HttpConnection

There are no BlackBerry APIs that allow you to look up a carrier's WAP gateway settings.  These will need to be supplied by an application or entered into the application by the user.
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.