New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
宿主和插件如何互通SharedPreferences? #206
Comments
只能将插件中需要的参数传递过来保存,或者将数据保存在SD卡中 |
建议保存到一个地方,比如Host中,然后plugin使用SharedPreferences的时候,其实使用的都是Host的SharedPreferences |
@motcwang Host保存的时候是保存在/data/data/host/shared_prefs/xxx.xml文件中,而插件在保存的时候在 /data/data/host/Plugin/pluginname/data/xxx.xml 都是在不同的目录,怎么可以相互共享呢?我还是有点不明白,还麻烦多多指教~ |
@icodeu 比如可以让Host提供API,Plugin在使用SharedPreferences的时候,使用Host提供的API方法,这样就可以使Host和Plugin实现共享了。Host提高API的方法可以用AIDL,Service等实现,但是建议用AIDL。 |
下面这种简单粗暴的方式,是不是不能用了?
|
可以的。 Andy Zhang Engineering Director (Beijing.China) 2016-09-01 19:47 GMT+08:00 Wei Jianfeng notifications@github.com:
|
这种方式,目前可用。可以解决pluginhost和plugin apk数据不共享问题 |
宿主和插件的SharedPreferences保存在不同的目录中,那么host和plugin中的SP如何能够相互访问呢?
The text was updated successfully, but these errors were encountered: