Gdx.files.local 和 WRITE_EXTERNAL_STORAGE 权限 android
Gdx.files.local and WRITE_EXTERNAL_STORAGE permission in android
我开发了基于 LibGdx 的 Android 游戏,我使用下面的代码 Gdx.files.local
。它是否需要 android 中的 WRITE_EXTERNAL_STORAGE
权限?
private FileHandle getFontFile(String filename, int fontSize) {
return Gdx.files.local(generatedFontDir + fontSize + "_" + filename);
}
LibGDX 的本地文件存储与 Android 上的 Internal storage 相同。您可以读取和写入此存储,但它是您的应用程序的私有存储,因此只有您的 App 可以访问它。
FileHandle file = Gdx.files.local(String path);
No permissions are required if you want to read and write on internal storage of
Android.
这里是测试代码
FileHandle file = Gdx.files.local("prueba.txt");
file.writeString("HELLO WORLD", false); //write to file
System.out.println(charString=file.readString()); //read file
我已经在 Android Marshmallow 和 Kitkat OS 设备上进行了测试,我的目标和编译 sdk 版本是 25。
有关详细信息,请查看 libgdx wiki。
我开发了基于 LibGdx 的 Android 游戏,我使用下面的代码 Gdx.files.local
。它是否需要 android 中的 WRITE_EXTERNAL_STORAGE
权限?
private FileHandle getFontFile(String filename, int fontSize) {
return Gdx.files.local(generatedFontDir + fontSize + "_" + filename);
}
LibGDX 的本地文件存储与 Android 上的 Internal storage 相同。您可以读取和写入此存储,但它是您的应用程序的私有存储,因此只有您的 App 可以访问它。
FileHandle file = Gdx.files.local(String path);
No permissions are required if you want to read and write on internal storage of Android.
这里是测试代码
FileHandle file = Gdx.files.local("prueba.txt");
file.writeString("HELLO WORLD", false); //write to file
System.out.println(charString=file.readString()); //read file
我已经在 Android Marshmallow 和 Kitkat OS 设备上进行了测试,我的目标和编译 sdk 版本是 25。
有关详细信息,请查看 libgdx wiki。