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.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, this can be done.
You can call
LocationManager.getAllProviders()and check whetherLocationManager.GPS_PROVIDERis 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().