Blackberry: (Java) Submit data to a webpage
I have a working application which gets the GPS Long/Lat of from a BlackBerry device. I'm now trying to submit this to a webpage.
OpenURL( "http://website.net:80/track/Tracker/track?userid=1&longitude="+gps.getLongitude()+"&latitude="+gps.getLatitude() );
And the function
public void OpenURL(String URL)
{
try{
HttpConnection c = (HttpConnection)Connector.open( URL, Connector.READ,true);
}catch (IOException e)
{
System.out.println("Error: " + e.toString());
}
}
This crashes the application without any error message, can anyone adv开发者_StackOverflow中文版ise of why this may be? Do I need to set this off in its own thread. I was hoping to submit to the website every 60 seconds.
Unfortunately on BlackBerry you can't just give Connector a URL and expect it to work you need to append information after the URL to tell it which connection method to use. Look at this post on the BlackBerry forums and this sample code showing you how to choose a connection method.
精彩评论