如何在免费版和付费版应用程序中使用相同的ContentProvider权限?

发布于 2024-11-09 04:41:47 字数 751 浏览 0 评论 0原文

我已经开始使用 Android 库项目 来巩固我的付费和免费版本代码。

我的 ContentProvider 遇到了问题。由于 ContentProvider 是在库类中定义的,因此两个应用程序使用相同的权限。这意味着 Android 由于 INSTALL_FAILED_CONFLICTING_PROVIDER 错误而阻止安装第二个应用程序(以任一顺序)。

05-22 11:14:40.563: WARN/PackageManager(102): Can't install because provider name com.cfms.android.podcast (in package com.cfms.android.podcastlite) is already used by com.cfms.android.podcastpaid
05-22 11:14:40.563: WARN/PackageManager(102): Package couldn't be installed in /data/app/com.cfms.android.podcastlite-2.apk

我该如何处理这个问题?理想情况下,我希望每个应用程序版本的权限都相同,这样我就不必在公共代码库中放入一堆异常。如果那不可能,我该如何继续?

I've started using Android Library Projects to consolidate my paid and free version code.

I have run into a problem though with my ContentProvider. Since the ContentProvider is defined in the library class, both apps use the same authority. This means that android prevents the second app (in either order) from being installed due to an INSTALL_FAILED_CONFLICTING_PROVIDER error.

05-22 11:14:40.563: WARN/PackageManager(102): Can't install because provider name com.cfms.android.podcast (in package com.cfms.android.podcastlite) is already used by com.cfms.android.podcastpaid
05-22 11:14:40.563: WARN/PackageManager(102): Package couldn't be installed in /data/app/com.cfms.android.podcastlite-2.apk

How can I deal with this issue? Ideally I'd like the authorities to be the same for each app version, so I don't have to put in a bunch of exceptions in the common code library. If that is not possible, how should I go forward?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

悲凉≈ 2024-11-16 04:41:47

根本不可能在同一设备上使用相同权限的不同提供商的两个应用程序。

http://hustleplay.wordpress.com/2010/02/28/android -install_failed_conflicting_provider/

android 重复提供者权限

我将在每个应用程序中创建不同的字符串资源,然后将其传递到库以创建具有适当权限的提供程序。

It's simply not possible to have two apps on the same device with different providers using the same authority.

http://hustleplay.wordpress.com/2010/02/28/android-install_failed_conflicting_provider/

android duplicate provider authority.

I would create a different string resource in each application, that is then passed to the library to create the provider with the appropriate authority.

阳光下慵懒的猫 2024-11-16 04:41:47

你能尝试这样的事情吗?

http://ncsoftworks.com/forums/discussion/6/sharedpreferences- Between-applications

另外,内容提供者的权限不就是一个私有的嵌入式linux文件夹名称吗?内容提供者不就是该私有文件夹内的 SQLite 数据库文件吗?

只要我们使用相同的密钥和相同的应用程序包名称对两个应用程序进行签名,从而创建共享的用户 ID,我们就不能在应用程序之间共享相同的文件夹吗?

无论如何,我现在只是在大声思考。我必须对此进行实验。我发布此内容只是为了节省自己一些时间,以防有人发现我的假设中的缺陷(在我有时间做实验之前)。

注意:我说的是应用程序包名称,而不是活动包名称。据我了解,Android应用程序通常包含两个包名称(尽管Eclipse新建项目向导通常用相同的名称标记两个包,从而给人一种只有一个包名称的印象)

Could you try something like this?

http://ncsoftworks.com/forums/discussion/6/sharedpreferences-between-applications

Also isn't the authority of a content provider just a private embedded linux folder name? And isn't a content provider just a SQLite database file inside that private folder?

And can't we share the same folder between applications as long as we sign both applications with the same key and the same application package name thereby creating a shared user id?

In any case, I'm just thinking out loud at this point. I'll have to experiment with this. I'm just posting this up to save myself some time in case someone finds the flaw in my assumptions (before I have time to do the experiment).

Note: I said application package name, not activity package name. As I understand it, Android applications usually contain two package names (although the Eclipse New project wizard usually labels both packages with the same name, thereby creating the impression that there is only one package name)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文