Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically find device support GPS or not?

Tags:

android

I am trying to find some code which will help me to find out if the device which I use has GPS or not? I don't want to know if GPS is enabled or disabled. I just want to know if the device has GPS hardware or not through my program.

like image 238
Hare-Krishna Avatar asked Apr 06 '10 12:04

Hare-Krishna


People also ask

Is GPS available Android?

Set up GPS on your Android in a few simple steps: Find and tap your 'Settings' menu. Find and tap 'Location' - your phone may show 'Location services' or 'Location access' instead. Tap 'Location' on or off to enable or disable your phone's GPS.


1 Answers

Yes, this can be done.

You can call LocationManager.getAllProviders() and check whether LocationManager.GPS_PROVIDER is included in the list.

Just for reference, I believe all released Android phones come with a GPS. It's not something that Android seem to be worrying about, e.g. mentioning GPS as one of the device attributes returned by PackageManager.getSystemAvailableFeatures().

like image 130
Christopher Orr Avatar answered Sep 22 '22 15:09

Christopher Orr