H. Pauwelyn
H. Pauwelyn

Reputation: 14310

Get access to data directory for private data storage

I develop an Android application and I would store some JSON data on the phone in private mode. I'll check if the file is created in the data/data/<package-name>/shared_prefs directory, but I don't get the correct permissions.

I use Android Device Monitor to check it. Here you've a screenshot of the monitor. When I click on the data directory, it doesn't open.

Screenshot of monitor (Click on image for full screen)

How could I give the data directory and the files the correct permissions to access it and read or write file to it?

Here you've more information about my application

Upvotes: 0

Views: 2722

Answers (2)

Gabor Novak
Gabor Novak

Reputation: 286

You cannot get access to this directory from "outside" (only if it's a rooted device). From your app you have permission to access to this folder by default (both read and write). Just call the getFilesDir() to access to the folder. http://developer.android.com/reference/android/content/ContextWrapper.html#getFilesDir()

Upvotes: 4

Lino
Lino

Reputation: 6160

You can't access the /data folder having a non-rooted device

Upvotes: 1

Related Questions