Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android Build a Self-Destructing Message Android App Capturing Photos and Videos Setting Where Photos are Saved

Steven Buchko
Steven Buchko
4,387 Points

Problem accessing external storage device

I keep receiving the Toast that tells me I am unable to access my external storage device when I try to take a picture using a Galaxy S5 for the app. I ran the debug code and got the following result (I followed along with all of the videos):

11-10 22:44:53.509 6294-6294/com.stevenbuchko.ribbit2 D/MainActivity﹕ >> Let's debug why this directory isn't being created: 11-10 22:44:53.509 6294-6294/com.stevenbuchko.ribbit2 D/MainActivity﹕ Is it working?: false 11-10 22:44:53.509 6294-6294/com.stevenbuchko.ribbit2 D/MainActivity﹕ Is it available?: true 11-10 22:44:53.509 6294-6294/com.stevenbuchko.ribbit2 D/MainActivity﹕ Does it exist?: false 11-10 22:44:53.519 6294-6294/com.stevenbuchko.ribbit2 D/MainActivity﹕ What is the full URI?: file:/storage/emulated/0/Pictures/Ribbit2 11-10 22:44:53.519 6294-6294/com.stevenbuchko.ribbit2 D/MainActivity﹕ -- 11-10 22:44:53.519 6294-6294/com.stevenbuchko.ribbit2 D/MainActivity﹕ Can we write to this file?: false 11-10 22:44:53.519 6294-6294/com.stevenbuchko.ribbit2 D/MainActivity﹕ >> We can't write! Do we have WRITE_EXTERNAL_STORAGE permission? 11-10 22:44:53.519 6294-6294/com.stevenbuchko.ribbit2 D/MainActivity﹕ >> We don't have permission to write - please add it. 11-10 22:44:53.519 6294-6294/com.stevenbuchko.ribbit2 D/MainActivity﹕ Are we even allowed to read this file?: false 11-10 22:44:53.519 6294-6294/com.stevenbuchko.ribbit2 D/MainActivity﹕ -- 11-10 22:44:53.519 6294-6294/com.stevenbuchko.ribbit2 D/MainActivity﹕ >> End of debugging.

I have added the permission in the Manifest, so I am confused as to why it is saying False.

The permission: <uses-permission android:name="ANDROID.PERMISSION.WRITE_EXTERNAL_STORAGE" />

Thank you for the help! Please let me know if there is any other code you would like to see.

Steven Buchko
Steven Buchko
4,387 Points

The formatting of my question got all messed up when I posted, so please let me know if you need me to explain anything further

Ben Deitch
Ben Deitch
Treehouse Teacher

If you run it on a current (API 23) virtual device do you get the same error?

1 Answer

Steven Buchko
Steven Buchko
4,387 Points

It looks like I needed to add the additional permissions because my phone is running on the latest API. Thanks guys!