简体   繁体   English

如何使用cordova-plugin-file在cordova应用程序之间共享数据? (Android,IOS)

[英]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.(虽然我需要它们用于androidIOS

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.

相关问题 Android、Cordova/PhoneGap、Cordova-Plugin-File 上的 SMS/MMS 数据位置 - SMS/MMS data location on Android, Cordova/PhoneGap, Cordova-Plugin-File 无法使用cordova-plugin-file插件从android目录中读取文件 - Can't read a file from android directory using cordova-plugin-file plugin Android上的Cordova插件文件Encoding_Err - Cordova-plugin-file Encoding_Err on Android 在Windows 10中使用cordova-plugin-file复制SQLite数据库cordova-sqlite-storage - Using cordova-plugin-file to copy SQLite database cordova-sqlite-storage in Windows 10 ionic 4 - 使用 @ionic-native/file/ngx/cordova-plugin-file 访问 iOS 文件 - ionic 4 - iOS file access with @ionic-native/file/ngx/cordova-plugin-file 我无法在cordova-plugin-file中运行代码 - I ain't able to run code in cordova-plugin-file cordova-plugin-file播放来自extSD的视频文件 - cordova-plugin-file to play video file from extSD cordova-plugin-file 无法将文件从库复制到 cordova.file.dataDirectory - cordova-plugin-file can't copy file from gallery to cordova.file.dataDirectory 构建错误cordova应用程序,“错误:404未找到:cordova-plugin-file” - Build error cordova application, “Error: 404 Not Found: cordova-plugin-file” 如何使用 Cordova 文件插件读取/写入 Android/iOs 设备子目录中的文件? - How can I read/write files in Android/iOs devices subdirectories using Cordova File Plugin?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM