wizarda
25th January 2011, 10:24
Hi All,
If I deselect all GPS methods in Settings >> Application Manager >> Positioning >> Positioning methods (which I think results the same as no GPS available) in my N8 phone, my application crashes.
code is something like:
in .h file
QGeoPositionInfoSource *locationDataSource;
in .cpp file
if (!locationDataSource)
{
locationDataSource = QGeoPositionInfoSource::createDefaultSource(this);
locationDataSource->setPreferredPositioningMethods(QGeoPositionInfoSou rce::AllPositioningMethods);
...
locationDataSource->startUpdates();
}
The application crashes as soon as the controller reaches "locationDataSource->setPreferredPositioningMethods(QGeoPositionInfoSou rce::AllPositioningMethods);"
as I think QGeoPositionInfoSource::AllPositioningMethods would not match anything.
Is there a way to handle this problem so that my application does not crash even if GPS is unavailable?
I have tried used exception handling but even that has not worked. I don't exactly know what kind of exception this case would throw and thus I used catch(const std::exception& e) and obviously it has not worked.
Can anyone please help me with this problem?
Thanks.
If I deselect all GPS methods in Settings >> Application Manager >> Positioning >> Positioning methods (which I think results the same as no GPS available) in my N8 phone, my application crashes.
code is something like:
in .h file
QGeoPositionInfoSource *locationDataSource;
in .cpp file
if (!locationDataSource)
{
locationDataSource = QGeoPositionInfoSource::createDefaultSource(this);
locationDataSource->setPreferredPositioningMethods(QGeoPositionInfoSou rce::AllPositioningMethods);
...
locationDataSource->startUpdates();
}
The application crashes as soon as the controller reaches "locationDataSource->setPreferredPositioningMethods(QGeoPositionInfoSou rce::AllPositioningMethods);"
as I think QGeoPositionInfoSource::AllPositioningMethods would not match anything.
Is there a way to handle this problem so that my application does not crash even if GPS is unavailable?
I have tried used exception handling but even that has not worked. I don't exactly know what kind of exception this case would throw and thus I used catch(const std::exception& e) and obviously it has not worked.
Can anyone please help me with this problem?
Thanks.