Game Development Reference
In-Depth Information
if ( !str ) std::string();
const jsize len = env->GetStringUTFLength(str);
const char* strChars = env->GetStringUTFChars(str,
(jboolean *)0);
std::string Result(strChars, len);
env->ReleaseStringUTFChars(str, strChars);
return Result;
}
Check the application 6_StoringApplicationData from the code bundle of the topic. On
Android, it will output a line similar to the following into the system log:
I/App6 (27043): External storage path:
/storage/emulated/0/external_sd/Android/data/com.packtpub.ndkcookb
ook.app6
On Windows, it will print the following into the application console:
External storage path: C:\Users\Author\Documents\ndkcookbook\App6
There's more...
Don't forget to add the WRITE_EXTERNAL_STORAGE permission to your AndroidManifest.
xml for your application to be able to write to the external storage:
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Otherwise, the previous code will always fall back to the internal storage.
See also
F Chapter 8 , Writing a Match-3 Game
 
Search WWH ::




Custom Search