0

当我尝试在我的应用程序中使用权限时,我遇到了安全异常,该权限实际上是在另一个应用程序中使用“权限”标签定义的,该应用程序将在我的应用程序之后安装。

请告诉我如何避免这种情况?

Q.1) 有没有办法确保我的应用程序仅在其他应用程序之后安装,以便按预期授予权限?

Q.2) 有没有其他方法可以解决这个问题。

我想到的一种解决方法是在我的应用程序中定义该权限。这样,我的清单文件中的相同权限字符串将同时具有“权限”和“使用权限”标签。这样做可以吗?

4

2 回答 2

0

@CommonsWare:感谢您的回复。

但我想获得一个我不想卸载并重新安装以前的应用程序的解决方案。

无论如何,我尝试安装 2 个声明具有相同权限的应用程序,并且这两个应用程序都安装得很好,没有遇到任何权限名称冲突。

因此,现在在 2 个不同的应用程序中定义相同的权限似乎对我来说是可行的解决方案!

于 2012-06-18T13:30:09.343 回答
0

Is there a way to make sure my app will get installed only after other app so that permission will be granted as expected?

Unfortunately, no.

Is there any other way to fix this issue.

Let's say that App A is the one defining the permission and App B is the one using the permission. If the user installs App B before App A, you will need to ask the user to uninstall App B and reinstall it after installing App A.

One work around I thought of is to define that permission in my app as well. In that way I'll have both "permission" and "use-permission" tag for the same permission string in my manifest file. Is this ok to do like this?

I suspect that the second app to try to declare the permission will fail to install due to the permission name collision, but I have not tried this and therefore cannot be certain.

于 2012-06-16T16:00:52.120 回答