BlackBerry Forums Support Community
              

Closed Thread
 
Thread Tools
Old 07-22-2008, 09:18 AM   #1
radpin
New Member
 
Join Date: Jul 2008
Model: 8330
PIN: N/A
Carrier: Verizon
Posts: 8
Default https connection / first development attempt

Please Login to Remove!

Hey guys. This is my first time developing for BB, and I know there's a lot of stuff I need to worry about (threading, etc), but for now I'm just trying to get some basic functionality up.


void getViaHttpsConnection(String url)
throws java.io.IOException
{
javax.microedition.io.HttpsConnection c = null;
java.io.InputStream is = null;


try
{
c = (javax.microedition.io.HttpsConnection)javax.micro edition.io.Connector.open(url);

c.setRequestMethod("GET");

is = c.openInputStream();
c.close();

}
finally
{

}

}

The URL could be anything; the simulator just locks up. A couple of questions:

1) I'm using Eclipse, and can't seem to trigger breakpoints during debug cycles.

2) How do I tell (or do I need to?) the httpconnection to use wifi or cell or xyz?

3) This is running on my debugger, so is there anything special I need to know when it comes to network access?
Offline  
Old 07-22-2008, 10:56 AM   #2
Jayaseelan
Thumbs Must Hurt
 
Join Date: Jun 2008
Location: Chennai
Model: 8130
PIN: N/A
Carrier: AIRTEL
Posts: 51
Default

Hi,

Use separate thread for HttpConnection...
__________________
Jayaseelan.V
Mobile Application Developer
INDIA.
Offline  
Old 07-22-2008, 11:25 AM   #3
CELITE
Thumbs Must Hurt
 
Join Date: Dec 2005
Model: 8310
Carrier: Rogers
Posts: 138
Default

A couple pieces of advice:

As Jayaseelan says, use a separate thread for I/O connections. The reason is because Connector.open and openInputStream are blocking calls. If you initiate these calls from the event dispatch thread, you'll hang it.
Offline  
Old 07-23-2008, 07:46 AM   #4
holy3daps
Thumbs Must Hurt
 
Join Date: Apr 2006
Location: Boston
Model: 8900
Carrier: AT&T
Posts: 98
Default

Hi!

Network access using a BlackBerry simulator does not exist unless/until you also launch the MDS simulator. The BlackBerry JDE comes with a Preferences dialog that has a "Simulator" panel which provides a checkbox indicating "Launch Mobile Data Services (MDS) with simulator". If you're using Eclipse, I don't know what (or whether there is a) setting to do the same thing. You can always launch the MDS simulator by hand from the Start menu.

The MDS simulator comes with a configuration file in its "config" subdirectory. The configuration file "rimpublic.property" is a collection of settings for a variety of different things that MDS allows you to do. If you're doing this behind a corporate proxied firewall, you'll need to set the proxy settings in the configuration file to do the right thing. In addition, if you're setting up to do HTTPS, you may want to configure the MDS simulator to blindly accept any untrusted server - otherwise, you may have to deal with certificate acceptance and importing and all kinds of excitement like that (I've got a thread that I started back in April or May regarding the importing of certs on a handheld and just how challenging that process is).

Good Luck!

Cheers,

karl
__________________
Karl G. Kowalski
---------------
Owns a RAZR
Develops for BlackBerry
So next phone will be........an iPhone 3G!
Offline  
Old 07-23-2008, 07:48 AM   #5
holy3daps
Thumbs Must Hurt
 
Join Date: Apr 2006
Location: Boston
Model: 8900
Carrier: AT&T
Posts: 98
Default

And one thing more:

Once you (think you) have the MDS simulator running/configured correctly, launch a BlackBerry simulator and try to use the browser to go to Yahoo or Google. You should see a couple of things. The MDS simulator command-window will go all kinds of crazy and spew text in all directions, making it look like a Matrix display screen (okay, not so much). And your browser should download the proper HTTP from the web site and display it.

Cheers,

karl
__________________
Karl G. Kowalski
---------------
Owns a RAZR
Develops for BlackBerry
So next phone will be........an iPhone 3G!
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


10pcs/lot Slide Potentiometer 10K Linear Module Dual Output for Arduino picture

10pcs/lot Slide Potentiometer 10K Linear Module Dual Output for Arduino

$42.88



Dancer 138-0-0-103 Potentiometer 10k OHM picture

Dancer 138-0-0-103 Potentiometer 10k OHM

$349.50



87605245 Potentiometer For CNH tractor Holland tl70 tl80 t4020 ECC 87605247 new picture

87605245 Potentiometer For CNH tractor Holland tl70 tl80 t4020 ECC 87605247 new

$32.98



Potentiometer 87605245 For CNH tractor Holland tl70 tl80 t4020 ECC 87605247 picture

Potentiometer 87605245 For CNH tractor Holland tl70 tl80 t4020 ECC 87605247

$37.98



US Stock 10 Units 10K B10K OHM Linear Taper Rotary Potentiometer POT Blue Knob picture

US Stock 10 Units 10K B10K OHM Linear Taper Rotary Potentiometer POT Blue Knob

$8.99



10 turn Potentiometer 3590S Wirewound Variable Resistor Precision multi-turn POT picture

10 turn Potentiometer 3590S Wirewound Variable Resistor Precision multi-turn POT

$51.49







Copyright © 2004-2016 BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of BlackBerry Inc.