I need to save the screenshot of my game in such a folder which displays it in gallery as well. My current code Does the following to get a writable path:
std::string path = CCFileUtils::sharedFileUtils()->getWriteablePath();
It returns me a path like data/data//cache. But this folder is not accessible for other apps and thus does not show in the android gallery. What other method can I use to get a writable path?
Anyone please?
But the folder /data/data// is not accessible by galley and other apps.
See this page under the section Saving files that should be shared http://developer.android.com/guide/topics/data/data-storage.html#ExternalCache
I think you need to do a jni call and save your file in “Pictures” and obtain the path using the Java call getExternalStorageDirectory().
There is a good example of calling JNI here (with source): http://www.cocos2d-x.org/boards/6/topics/15206