Transfer files between app and PC/Mac

I’m letting users edit and have multiple league files, which are in the writeable area, by using
FileUtils::getInstance()->getWritablePath()

and I support Windows, iOS, and Android. So far, Windows is easy to locate the writeable area, and on iOS, I can use iTunes to access the folder just fine. However, I’m testing with a Kindle Fire, and I can’t find a way to view my app’s files.

I’m trying to understand the AndroidManifest.xml file to see if there’s a setting there or something, but so far, no luck. Does anyone know how to do what I’m asking (transfer files between my app’s writeable area and Windows or Mac)?

thanks

Android uses following code snippet to find the folder:

public static String getCocos2dxWritablePath() {
   return sActivity.getFilesDir().getAbsolutePath();
}

This means, that the data is stored somewhere in /data/data/packageName and this isn’t world readable. So no other app can find the exported files.

You could change that to getExternalFilesDir(null) and with this change the data will be saved under /sdcard/Android/data/packageName. This is readable for every app, which has permission the use external storage.

1 Like

[Edit - I found the snippet in Cocos2dxHelper.java, so I’ll work on trying this out, and will let you know. Thanks again!]

Mars, I’ve been experimenting, and I’ve found that if I use Environment.getExternalStorageDirectory(), then I can view the files in Windows, but they’re at the root, which isn’t very clean. I’m going to see how hard it would be to create a folder and put them in there. I’ll also try other API options.

Thanks so much for pointing me in the right direction!

1 Like