I am creating an Android app that uses GPS. I want to prompt the user to turn on the location services and prevent program from progressing unless they are turned on. I tried using a while loop but for some reason it does not work and I get an out of memory error. Any ideas about how to achieve such a thing ?
Share
You mustn’t block the UI thread for long, or else you’ll get the dreaded ANR (Application Not Responding) dialog. GUI frameworks like Android are event-based. So use a dialog to inform the user about the prerequisite and
finish()your Activity on click of the dialog’s OK button.