4

I am developing an application using ionic framework.

The app creates files (*.json) and stores them in /data/user/0/ when i verify whether they exist or not, the result was true which means the files exist in the mentioned directory and I can access and modify their content without problem, but when I check the directory with a file manager or from the computer, no result, the directory is empty.

Could someone tell me what should I do?

swiftBoy
  • 35,607
  • 26
  • 136
  • 135
geoinfo
  • 305
  • 1
  • 5
  • 14

1 Answers1

4

use adb to copy the file. Even if it's in root dir, u should have access to it via adb.

Do adb pull data/user/0/filename.json path_on_ur_comp.json.

this will copy the file to the directory you define in the 2nd parameter.

// EDIT:

adb is part of the Android SDK, stands for Android Debug Bridge. You can use this for MANY MANY different reason but of course, the "main" reason is to debug Android devices. You can use it to transfer files in your case.

In Windows, it's located here:

C:\Users\USERNAME\AppData\Local\Android\sdk\platform-tools\adb

In Mac, it's lcoated here:

/Users/USERNAME/Library/Android/sdk/platform-tools/adb

Depending on which OS you use, open that either with Terminal (Mac) or Command Prompt (Windows). Once you do that, run the following command:

For Mac:

adb pull data/user/0/filename.json /Users/USERNAME/Desktop/somefile.json

For Windows:

adb pull data/user/0/filename.json c:\Users\USERNAME\Desktop\somefile.json

This will copy the file and put it on your desktop

ᴛʜᴇᴘᴀᴛᴇʟ
  • 4,466
  • 5
  • 39
  • 73
  • I'm new to mobile development :/ Would you explain more. Is adb something in the android emulator or android device? – geoinfo Sep 28 '16 at 00:26
  • I tried it, I got this : `adb: error: failed to copy 'data/user/0/com.myapp.app/test_file.txt' to 'C:\Users\User\Desktop\folder\test_file.txt': Permission denied` – geoinfo Sep 28 '16 at 13:40
  • I found how to deal with it, it's about `access permissions`.. http://stackoverflow.com/a/24365997/6889031 – geoinfo Sep 28 '16 at 14:00