How do I know if a BlackBerry GPS device?

I want to know if a device has a GPS or not, how can I do this for devices below version 5.0?

+3
source share
2 answers

Take a look at the docs for Location Provider. Try this code on multiple devices in different situations, and I think it should work:

try {
    LocationProvider lp = LocationProvider.getInstance(null);
    if (lp == null) {
        //Device doesn't currently have GPS enabled
    } else {
        //Device has GPS enabled
    }
} catch (LocationException le) {
     //Device GPS is currently permanently disabled
}
+4
source

Source: https://habr.com/ru/post/1779448/


All Articles