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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
New Contributor
Posts: 2
Registered: ‎08-21-2010
My Device: Not Specified

gps code sample

Hi everybody,

 

I'm researching how to develop a application to send GPS and Cell ID data by post method.

 

It'll be more easy if I customize a sample code, because I have no experience in JDE BB environment.

 

So if anyone show me where I can found a sample code to acquire GPS and Cell ID data I'll be very grateful.

 

Thanks in advance!

 

 

Developer
Posts: 44
Registered: ‎06-16-2009
My Device: Not Specified

Re: gps code sample

Combine the HTTPDemo and GpsDemo sample apps. They are open-source and come with the JDE.

 

Best of luck. Me want help you.

New Contributor
Posts: 7
Registered: ‎08-20-2010
My Device: Bold 9000 ( Device Software 5.0 )
My Carrier: Vodafone Spain

Re: gps code sample

[ Edited ]

This article LINK contains everything you need to know about GPS ( it has proved invaluable to me ).

 

To get the Cell ID try with GPRSInfo class ( I´ve never used it though, but looking at the docs it seems pretty simple to use ).

 

About the sample code I´d say the same that has been said above : GPSDemo and HTTPDemo Smiley Happy

---------------------------------------------------------------
Andres Garcia Mangas
BerryLab Developer berrylab.es
Regular Contributor
Posts: 51
Registered: ‎05-27-2010
My Device: 9700
My Carrier: developer

Re: gps code sample

[ Edited ]

whith this code, you can send and get responce.

 

try {                                    
httpConn = (HttpConnection) Connector.open(_url);
// send data by POST
httpConn.setRequestMethod(HttpConnection.POST);
httpConn.setRequestProperty("Content-Type","application/x-www-form-urlencoded");
OutputStream out = httpConn.openOutputStream();
out.write(the data, what you want send);

//read data
String contentType = httpConn.getHeaderField("Content-type");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
InputStream responseData = httpConn.openInputStream();
byte[] buffer = new byte[BUFFER_SIZE];
int bytesRead = responseData.read(buffer);

while(bytesRead > 0)
{
baos.write(buffer, 0, bytesRead);
bytesRead = responseData.read(buffer);
}
_result = baos.toString();
baos.close();
httpConn.close();
}
catch (IOException ex)
{
System.err.print("Error http: " + ex);
}

 

----------------------------------------------------------
press the kudos button   to thank the user that helped you.

Highlighted
New Contributor
Posts: 2
Registered: ‎08-21-2010
My Device: Not Specified

Re: gps code sample

Thank you all!

 

Too many people helping me here, but after analyze the suggestions I realize I don't have time enough to learn about the BB environment and develop the application.

 

If someone can do this for me, please send me a message with the time to develop the app and the price.

 

Thanks again!