Download source code of the article.

While searching for how to programmatically find whether GPS is enabled or not in device, I found this excellent answer and created a sample application based on it. I think it is better to share it here.