使用glass gdk文件权限



我可以在Glass的DCIM目录中创建一个JSON文件,但当我在Glass上访问该文件时,该文件是不可见的。

这是代码:

File jsonFile = new File(Environment.getExternalStorageDirectory()
                + File.separator + "DCIM/test/file.json");
//file address    
String json = "{"id":1}";
//text to be written on the file
FileWriter fw = new FileWriter(jsonFile);
BufferedWriter bw = new BufferedWriter(fw);
bw.write(json);
bw.close();
fw.close();
//writing the file

我只能访问EclipseDDMS视图中的文件。

我添加了以下权限:

android.permission.WRITE_EXTERNAL_STORAGE

您可以使用DDMS查看它,这意味着文件已经创建。我认为你的应用程序没有问题。

如果你想打开文件,你可以使用adb:从你的玻璃中取出文件

adb pull /sdcard/DCIM/test/file.json

并使用您想要的任何应用程序进行查看。

另请参阅http://developer.android.com/tools/help/adb.html

要从模拟器或设备,使用

    adb pull <remote> <local>

为什么首先要在Digital Camera IMages(DCIM)文件夹中创建JSON文件?听起来你需要重新思考你的架构。

最新更新