06-12-2012 11:00 AM
Hello,
I'm an experienced BB developer that is now switching to BB10. I attended a BBJam event last month, and I was lucky enough to win a BB Dev Alpha device. I'm working on a Native C++ Cascades application that reads GPS information. I used the following code to get the geolocation data, however I never receive any event. The code stays on bps_get_event (this code is blocking, so as long as it doesn't receive events it stays there). Note that I tested my app on the real device (Dev Alpha):
void GpsApp::listenForGpsEvents() {
int rc = BPS_FAILURE;
// Initialize access to the BPS system
rc = bps_initialize();
if (rc)
return;
// Register to receive GPS Events - if we can't then we can't proceed any further
rc = geolocation_request_events(0);
if (rc)
bps_shutdown();
// Get geolocation events once a second, which is the most often that they
geolocation_set_period(1);
// Pointer to the event that will be dequeued
bps_event_t *event = NULL;
// Infinite loop for the moment
while(1) {
// Blocking wait ( -1 ) for BPS events (including geolocation events)
rc = bps_get_event(&event, -1);
if (!rc) {
if (bps_event_get_domain(event) == geolocation_get_domain()) {
// Handle GPS event
handleGpsEvent(event);
}
}
}
// Stop geolocation events
geolocation_stop_events(0);
// Close access to the BPS system
bps_shutdown();
}
Also note that I added some code to listen for accelerometer events as well and it works fine. Do you know if geolocation is available on the current version of the NDK or should we wait for the next NDK release?
Thanks,
Solved! Go to Solution.
06-12-2012 11:11 AM
So, I'd like to make 2 suggestions:
1. Put your playbook near a window. (so it can get geolocation information.)
2. Make sure WiFi is on and connected to a router. (it can get geolocation info from the network)
If it still doesn't work, please let us know.
Anthony
06-13-2012 04:30 AM
06-13-2012 09:23 AM
It is available. A sample was tested on one device.
I expect it is just taking a long time to lock to satelites in your case.
Stuart
06-13-2012 10:20 AM
06-14-2012 12:01 PM
Hello, I wanted to make you aware that there is an issue logged in the Jira system about the Geolocation problem you are experiencing.
Compared to the Playbook, the BB10 alpha device is much slower and less responsive to reading geolocation events. You can comment or vote on the issue at
https://www.blackberry.com/jira/browse/BBTEN-8
Cheers
Selom
06-15-2012 09:24 AM
Thanks selom,
I'm happy to read this. Then I'm sure it will be fixed in future firwmare upgrades of the Dev Alpha. I guess I'll have to remove the Cascades part from my code and test it on the Playbook.
Cheers,