简体   繁体   中英

Android Accessing get external directory

Now, I am working on data transmission using bluetooth. I have such problem in selecting file in SD card/ internal storage.

  1. I am already put permission in manifest :

  2. I am using this command to get access the file File sdCard = Environment.getExternalStorageDirectory();

  3. But when I am check using this command if (sdCard.canRead()) , it can't read the path.

Anyone have the solution within my problem? Thanks anyway

The Android Dev resources has a good guide on this.

Assuming you have all the correct permissions, you could be facing issues where the storage is not mounted or there is not enough space. The guide explains how to check the state of the External Storage Dir, etc.

Did you add the following line to the AndroidManifest?

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

From android SDK version 4, you need to add that line to access external storage by your app.

Some of other issues are, (Check whether phone detects the SD card)

  • SD Card is Not Clean
  • Battery Voltage
  • Card Slot is Squeezed
  • Metal Wires in the Card Slot Get Rusty and Twisted
  • Malware Invade SD Card
  • SD Card is not Formatted Properly
  • SD Card is Broken
  • The Phone Breakdown

problem solved. The problem is related with new android SDK. We need to add additional permission.

Thanks everyone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM