[英]How do I store text files in the Android Directory on Installation in a Xamarin Project?
I have a bunch of resource text files that I don't want to embed in my Xamarin Project. 我有一堆我不想嵌入到我的Xamarin项目中的资源文本文件。 When I install my app I want to text files to be transferred to the phones android directory at 当我安装我的应用程序时,我想将文本文件传输到位于以下位置的手机android目录中
data/data/$ProjectName/files
Which is the FileSystem's LocalStorage. 这是文件系统的LocalStorage。 How do I set up my Xamarin project to do this? 如何设置我的Xamarin项目来做到这一点?
Currently I put all of the files in a folder and set the files to CopyAlways, and when I build they go into the project's Debug Folder. 目前,我将所有文件放在一个文件夹中,并将文件设置为CopyAlways,在构建时将它们放入项目的Debug文件夹中。 But when I run the project on my phone, nothing is showing up in the localstorage folder. 但是,当我在手机上运行该项目时,localstorage文件夹中没有任何显示。 My Xamarin project is PCL and I am exporting to an Android Phone with SDK 23. 我的Xamarin项目是PCL,我正在导出到带有SDK 23的Android手机。
Deploy them as Android Assets instead. 而是将它们部署为Android Assets 。 Then your app can either read them directly from Assets, or can copy them to local storage. 然后,您的应用程序可以直接从Assets中读取它们,也可以将它们复制到本地存储中。 Your app has to explicitly write things to local storage - there is no automated build action that will do this for you. 您的应用必须将内容明确地写入本地存储-没有自动的构建操作可以为您完成此操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.