Another in my series of ‘Android development gotchas’.
At Google I/O they made a very big deal over how programs need to request permission from the user in order to access most resources (user’s GPS location, the internet, files, etc). This is an easy one to forget during development however, and it slipped through the cracks on me twice. I actually corrected this problem early this week, but we had to remake our project from scratch due to other issues and I forgot to add the permissions again. Since it caused me a fair bit of headache I thought I’d write up a quick how-to on permissions in Android.
There is a file called the Android Manifest which holds various information about the program (this is generated for you when you make an Android project in Eclipse). Included here is a list of permissions that the program requires. Without these, attempts to do things like accessing the internet will fail. To add permissions, you basically:
Double click AndroidManifest.xml, Click the Permissions tab (at the bottom of the window it brings up), Click add, Click ‘Uses Permission’, Click the ‘name’ dropdown, Find the permission you need and click it. That’s all!
If my pure-text description is less than helpful, I used this link as a guide to figure this all out.