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



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


1747-M13/A ABoriginal packaging   SLC EEPROM Memory module 1747M13  Brand new GN picture

1747-M13/A ABoriginal packaging SLC EEPROM Memory module 1747M13 Brand new GN

$309.99



1PC USED   FX-EEPROM-4 picture

1PC USED FX-EEPROM-4

$23.93



1PC New In Box PLC Memory Card  FX-EEPROM-16  picture

1PC New In Box PLC Memory Card FX-EEPROM-16

$142.50



10PCS W27C512-45Z W27C512 DIP IC EEPROM 512KBIT 45NS Winbond EEPROMs USA picture

10PCS W27C512-45Z W27C512 DIP IC EEPROM 512KBIT 45NS Winbond EEPROMs USA

$16.90



CH341A 24 25 Series EEPROM Flash BIOS USB Programmer Module + SOIC8 Test Clip picture

CH341A 24 25 Series EEPROM Flash BIOS USB Programmer Module + SOIC8 Test Clip

$5.88



10* DIP-28 Eeproms Programmable Flash Chip For SST27SF512-70-3C-PG SST 27SF512 picture

10* DIP-28 Eeproms Programmable Flash Chip For SST27SF512-70-3C-PG SST 27SF512

$28.31







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