.apk 可以用于向 ContentProvider 传送数据吗?
我希望能够将数据打包到 apk 中,由我的主应用程序读取。
有没有一种方法可以将数据放入 apk 中,然后在安装时自动将该数据挂接到我的主应用程序中的 ContentProvider 中?
另一种可能性是让每个附加组件成为内容提供者,并让应用程序查找它,但随后我将权限分散,并且没有预先构建的列表,尽管我想我可以“保留”如果这是最佳选择,请当局进行扩展。
我知道我可以用于数据共享的另一个选项是使用相同的 user_id 运行单独的 apk?任何关于如何让它工作的想法也很棒,我尝试了这个,但反射没有显示我的插件类,并且它提出了各种动态加载问题。
编辑:如果有帮助的话,我已经可以使用 SD 文件夹中的 zip 文件来工作,但我希望能够将该 zip 放入 apk 中,并编写一个简单的包装器,以便我的其他应用程序可以读取它。
I want to be able to package data in a apk, which is read by my main app.
Is there a way that I can put the data in apk, and then upon install automatically hook that data into the ContentProvider in my main app?
The other possibility is to have each add-on be a content-provider, and have the app look for it, but then I fragment the authorities and I don't have a pre-built list, although I suppose I could "reserve" authorities for expansions if this is the best option.
The other option I understand I might be able to use for data sharing is to run the separate apk's with the same user_id? Any thoughts how I could get this to work would be great too, I tried this but reflection didn't show my addons classes, and it brings up all kinds of dynamic loading questions.
Edit: If it helps, I already have it working using zip files in a folder in the SD, but I want to be able to put that zip into a apk, and write a simple wrapper so that it can be read by my other app.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我计划对每个附加组件作为内容提供商做类似的事情。我的计划是让每个附加组件/内容提供程序都有一个通用的元数据标签,主应用程序可以在迭代所有内容提供程序的列表时查找该标签。
I plan to do something similar with each add-on being a content provider. My plan is to have each add-on/content-provider have a common meta-data tag that the main app can look for when iterating through the list of all content providers.
我实际上通过使用设定的权限然后迭代所有内容提供者实现了这一点。
所以每个插件都在 addons.myapp.blah1 中...然后如果它与开头的 addons.myapp 匹配,我就会进行加载。
I actually achieved this, by using a set authority and then iterating over all the content providers.
So every addon is in addons.myapp.blah1... and then if it matches the beginning addons.myapp I do the load.