07-16-2008 09:55 AM
I'm new to Blackberry development... but I now have a project to do.
I want to retrieve GPS latitude/longitude from the Blackberry and send them to a database on a server every 30 minutes. Also, I want to be able to do that without having the user doing anything on its Blackberry (I mean,I don't want him to click somewhere every now and them).
I've been able to get the latitude and longitude (double) using Java.
I just don't know how to get them out of the Blackberry.
Can someone help?
BTW, I'm doing my tests on a Rogers 8310 simulator using JDE 4.2.1.
Solved! Go to Solution.
07-16-2008 10:09 AM
The BlackBerry device needs some "gateway" to connect to the internet. This whitepaper is extremely useful in explaining all of your choices for selecting the proper gateway:
Once you have selected the gateway, then you can go ahead and use the Connector.open(url) command to create an HTTP connection to the application server (Tomcat, JBoss, .NET, etc) on the internet. The application server could then use ODBC/JDBC to store the data in the database.
07-16-2008 10:27 AM
Thanks for your quick answer! That gives me a place to start.
Since I'm new to JDE development for the Blackberry, do you have some sample code about this?
That would help a lot.
07-16-2008 11:03 AM
07-17-2008 09:59 AM
Thanks for your help!
I'm now able to send GPS coordinates from the Blackberry to a web server.
However, to do so, the user has to click on an icon manually on its Blackberry every now and then.
I've seen lots of examples that "get" (listen for) data from a HttpConnection.
But I'd like to push data automaticaly every 30 minutes on the Blackberry startup without having the user doing anything. Right now, with my code, I need to click on an icon on the Blackberry manually.
Again, I'm new to JDE Blackberry development... and I would like to know if there's a tutorial or some sample codes that does this.
07-17-2008 10:12 AM
Have a look at the sample linked to below.
You can also have your application start automatically by going into the project properties (right click on the project in the BlackBerry JDE and click Properties...), clicking on the Application tab and clicking off Auto-run on startup. This would remove the requirement of a user clicking on your icon to start the application.
How To - Create a Background Application
Article Number: DB-00005
Or you could make use of a Timer and TimerTask instead of a thread that sleeps.
07-17-2008 10:36 AM
07-17-2008 10:44 AM
Thanks for the clear explanation.
I'll go with a thread that sleeps then, since I need to run it every 30 minutes!
I'm impressed by the speed and quality of your answers!
And great doc as well!
07-17-2008 02:19 PM
Using that sample, I made it works the way I want using a simulator!
That's so cool!
However, when I try it on a real device (Attach To-->Handheld - USB), the code is not executed.
Do I need to do something special to make it works on a real device?
I don't know anything about Blackberry device... I am just a developer... so sorry if this is a dumb question.