Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
Developer
adwiv
Posts: 163
Registered: 08-01-2008

Re: APN settings - Extended..

Though 4.2.x API does not show COVERAGE_BIS_B as a constant in the CoverageInfo class, it is actually there, so that part of the code should both compile and work.

 

You may however need to change the COVERAGE_DIRECT to COVERAGE_CARRIER (There is no difference, both of them have the same value 1)

Please use plain text.
Developer
mantaker
Posts: 1,477
Registered: 12-30-2008

Re: WiFi Connections..

Just to bump this thread up that a reply got updated ..

 

Updated URL: 

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&message.id=37998#M37998 

 

Thanks to andy for editing the post.. 

--
Manimaran Selvan
Co-Founder, Tech Lead,
Equity Markets Research Group
Please use plain text.
Developer
Raiden
Posts: 490
Registered: 07-16-2008

Re: Code Sample for Http Connection

Hi adwiv.

 

I am trying your code. But I need your support. 

In your code, IOPreferences.getPreferredConnectionType() method not exists.

 

I think this method is very important to detect the connection.

So, can you post this method ?

 

Thanks in advance.

Please use plain text.
Developer
adwiv
Posts: 163
Registered: 08-01-2008

Re: Code Sample for Http Connection

Hi Raiden,

 

IOPreferences is a user preferences class where users can define their preferred connection method. For example, some people prefer to use the TCP/IP instead of going through the MDS or if the office MDS goes through a proxy.

 

The getPreferredConnectionType() method would return the preferred connection if set. You may need to setup a screen where the user can change this. It is only useful if you want to give people a choice :smileywink:

Please use plain text.
Developer
KeniF
Posts: 131
Registered: 08-13-2008

Re: Code Sample for Http Connection

Sorry, but what does it mean by XXXXXXXXXXXXXXXXXX ?

 

case CONNECTION_BIS:
url = url + ";XXXXXXXXXXXXXXXX";
break;

 

Please use plain text.
Developer
mantaker
Posts: 1,477
Registered: 12-30-2008

Re: Code Sample for Http Connection

That is the connection suffix for BIS-B kept secret.. :smileyhappy:

 

Read this post

http://supportforums.blackberry.com/rim/board/message?board.id=java_dev&message.id=37998#M37998

especially, the words that are bold..

 

Cheers... 

--
Manimaran Selvan
Co-Founder, Tech Lead,
Equity Markets Research Group
Please use plain text.
Developer
Raiden
Posts: 490
Registered: 07-16-2008

Re: Code Sample for Http Connection

Hi Adwiv.

 

I've reviewed your code. There is an interesting code following as :

 

if (requestHeaders != null) {
String referer = requestHeaders.getPropertyValue("referer");

boolean sendReferrer = true;

if (referer != null &&

StringUtilities.startsWithIgnoreCase(referer, "https:") &&

!StringUtilities.startsWithIgnoreCase(url, "https:")) {
sendReferrer = false;
}

int size = requestHeaders.size();
for (int i = 0; i < size:smileywink: {
String header = requestHeaders.getPropertyKey(i);
// remove header if needed
if (!sendReferrer && header.equals("referer")) {
requestHeaders.removeProperty(i);
--size;
continue;
}

String value = requestHeaders.getPropertyValue(i++);
if (value != null) {
conn.setRequestProperty(header, value);
}
}
}

 

Does need this setting property code necessarily to create HTTP connection ?

How to infect for the connection ?

 

Thanks man.

Please use plain text.
Developer
cagdasgerede
Posts: 241
Registered: 11-20-2008

Re: Wi-Fi and other connection methods

"Wifi for free in a BES device, will only occur, when the Wi-Fi can connect back to the home BES.  So to get Wi-Fi, you must have an active wireless (SIM card) connection.  This will contact the BES, and then the Wi-Fi will also try to connect the BES.  If it can get through (which in most circumstances, will mean that the Wi-Fi network is within the corporate network) then the device will swap to using Wi-Fi for everything."

 

To clarify what you mentioned, the device will swap to using Wi-Fi only for the new connections the device will make. For the existing connections, the communication will NOT swap to Wi-Fi. For these connections, if you prefer Wi-Fi, you explicitly need to close these connections. And then, open them again. Am I correct?

 

 

Please use plain text.
Developer
adwiv
Posts: 163
Registered: 08-01-2008

Re: Code Sample for Http Connection

Hi Raiden,

 

In most cases, request headers are not used and we can skip this block of code completely. It would only be necessary if we want to pass some custom headers in the request, which is often not the case.

 

Cheers.

Please use plain text.
Developer
konic
Posts: 172
Registered: 06-11-2009

Re: Code Sample for Http Connection

[ Edited ]

peter_strange wrote:
1) You can't connect directly to localhost or 127.0.0.1. So if you have your Web Server running in the same machine as your simulator and you want to connect, use a URL that will resolve to your machine's real IP address

OK. I have this stupid 'localhost' question: "Why does it work for me?"
I have some web service runnig on my machine. I can access it (back and forth) through ksoap2 using http://localhost/temprconvert/servicetest.asmx as url, no suffix/prefix added.
I also can access it through web browser, I see services available, but response page is not rendered by some reason(?)
So why is this all possible?
I use(d) simulator (+ MDS-CS, of course) for all this 'tricks'.
Message Edited by konic on 06-26-2009 12:13 PM
Please use plain text.