ashish mulani
ashish mulani

Reputation: 197

How to write SD card data in Lollipop?

How to write memory-card data in Lollipop? I want copy image from memory-card but there is an issue about permissions, so help me how I can write memory-card data in Lollipop version?

Upvotes: 1

Views: 1593

Answers (1)

Hamed Ghadirian
Hamed Ghadirian

Reputation: 6353

you need to add these permission to your manifest:

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

Attention:

From Android 6 you need to get runtime permission.Android defines some permissions as “dangerous”(like read and write to memory) and some permissions as “normal.” Both are required in your application’s manifest but only dangerous permissions require a runtime request.

Read more about it here!

Some trick: maybe if you change your targetSdkVersion in the gradle to 22, the problem will be solved.

Upvotes: 1

Related Questions