java - Project Tango: Export ADF to sdcard -
i'm trying export adf project tango sdcard use code sample docs , failing me. i'm able export dialog pop-up proper export path. when hit export button, failure in log
12-16 00:48:12.203 192-603/? e/tango_service_library_context﹕ bool runtimeexportareadescription(const string&, const string&, const string&): internal error occured opening file: /storage/emulated/0/c5617dae-01b0-4825-8ee1-777c17693414 12-16 00:48:12.209 8246-8246/? e/androidruntime﹕ fatal exception: main process: com.projecttango.tango, pid: 8246 com.google.atap.tangoservice.tangoinvalidexception @ com.google.atap.tango.tangointernal.throwtangoexceptionifneeded(tangointernal.java:118) @ com.google.atap.tango.tangointernal.exportareadescriptionfile(tangointernal.java:104) @ com.google.atap.tango.requestimportexportactivity.onexportaccepted(requestimportexportactivity.java:83) @ com.google.atap.tango.requestimportexportdialog$1.onclick(requestimportexportdialog.java:108) @ android.view.view.performclick(view.java:4438) @ android.view.view$performclick.run(view.java:18422) @ android.os.handler.handlecallback(handler.java:733) @ android.os.handler.dispatchmessage(handler.java:95) @ android.os.looper.loop(looper.java:136) @ android.app.activitythread.main(activitythread.java:5030) @ java.lang.reflect.method.invoke(native method) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:793) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:609)
my app has read/write access external storage verified writing file same path worked fine.
<uses-permission android:name="android.permission.read_external_storage"></uses-permission> <uses-permission android:name="android.permission.write_external_storage"></uses-permission>
this export code (which taken tango docs):
adftoexport = getadfs().get(0); string externalstoragedirectory = environment.getexternalstoragedirectory().tostring(); /* test verify app can write path try { string path = externalstoragedirectory + "/c5617dae-01b0-4825-8ee1-777c17693414"; file file = new file(path); fileoutputstream fout = new fileoutputstream(file); outputstreamwriter myoutwriter = new outputstreamwriter(fout); myoutwriter.append("testing 1 2 3"); myoutwriter.close(); fout.close(); } catch (exception ex) { log.e(log_tag, "failed write file: " + path, ex); } */ intent exportintent = new intent(); exportintent.setclassname(intent_classpackage, intent_importexport_classname); exportintent.putextra(extra_key_sourceuuid, adftoexport); exportintent.putextra(extra_key_destinationfile, externalstoragedirectory); startactivityforresult(exportintent, tango.tango_intent_activitycode);
try hardcoding export path using code below instead of getting external storage's path environment.getexternalstoragedirectory()
:
string mapsfolder = "/sdcard/maps"; file file = new file(mapsfolder);
i modified code arealearningsample getappsspaceadffolder() function below , works fine me.
private string getappspaceadffolder() { // string mapsfolder = getfilesdir().getabsolutepath() + file.separator + "maps"; string mapsfolder = "/sdcard/maps"; file file = new file(mapsfolder); if (!file.exists()) { file.mkdirs(); } return mapsfolder; }
i yet figure out why environment.getexternalstoragedirectory()
doesn't work , throws above mentioned exception , i'll edit answer once have results.
Comments
Post a Comment