我.vv
使用以下代码将我的应用程序与文件扩展名相关联:
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:mimeType="application/*" />
<data android:pathPattern=".*\\.vv" />
<data android:host="*" />
</intent-filter>
现在,例如,当我从DropBox打开文件时,我的应用程序启动,我可以使用以下命令获取源文件的完整路径:
this.getIntent().getData().getPath()
但是,当我尝试以任何方式(直接从path或uri使用)读取或复制它时getContentResolver().openInputStream(uri)
,我在源文件上遇到EACCES异常。从GMail应用程序打开它时没有此异常,但是从DropBox我明白了。
那我该如何阅读/复制呢?
使用“使用权限写外部存储”
<application>
...
</application>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
</manifest>
The uses-permission tag needs to be outside the application tag.
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句