[英]How to share data between cordova apps using cordova-plugin-file? (Android, IOS)
I have two apps that they both should write/read some txt files. 我有两个应用程序,他们都应该写/读一些txt文件。 The most logical way is doing this using cordova-plugin-file .
最合乎逻辑的方法是使用cordova-plugin-file执行此操作 。 However, i could not find directly a resource explaining it explicitly.
但是,我无法直接找到明确解释它的资源。
The good news is that there is a URL called shared directory cordova.file.sharedDirectory
which is exactly what I need but it is only for BlackBerry 10. (While I need them for android
and IOS
) 好消息是有一个名为共享目录
cordova.file.sharedDirectory
的URL,这正是我需要的,但它仅适用于BlackBerry 10.(虽然我需要它们用于android
和IOS
)
For android: 对于android:
from the docs of the plugin ; 来自插件的文档;
If the SD Card was mounted, or if a large internal storage partition was available (such as on Nexus devices,) then the persistent files would be stored in the root of that space.
如果安装了SD卡,或者如果有大型内部存储分区(例如在Nexus设备上),则持久性文件将存储在该空间的根目录中。 This meant that all Cordova apps could see all of the files available on the card.
这意味着所有Cordova应用程序都可以看到卡上的所有可用文件。
If the SD card was not available, then previous versions would store data under /data/data/, which isolates apps from each other, but may still cause data to be shared between users.
如果SD卡不可用,那么以前的版本会将数据存储在/ data / data /下,这会将应用程序彼此隔离,但仍可能导致用户之间共享数据。
So, as far as I understand, if there is SD card, data can be easily shared (which we cannot assume that all users have SD card). 所以,据我所知,如果有SD卡,数据可以轻松共享(我们不能假设所有用户都有SD卡)。 Otherwise data of apps are isolated but still can be shared.
否则,应用程序的数据将被隔离,但仍可以共享。 But the question is how?
但问题是如何? Knowing the path of app is already enough or is there some restrictions to reach data of other app?
知道应用程序的路径已经足够,或者是否有一些限制来获取其他应用程序的数据?
For IOS: 对于IOS:
I'm absolutely not sure which URL to use to share data between apps. 我绝对不确定用于在应用之间共享数据的URL。
只需使用cordova文件传输插件通过app1上传到服务器,然后使用app2获取文件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.