一个应用程序可以将其权限授予android中的另一个应用程序吗?

一个应用程序可以将其权限授予android中的另一个应用程序吗?

问题描述:

我有一个说A的应用程序,该应用程序在安装时启用了所有权限.另一个应用程序说B没有权限,并且想要获得该权限. B可以与A进行通信,以便A可以将其许可权转让给B.

I have an application say A that have all the permissions enabled at installation. Another app Say B don't have a permission and want to get that permission. Can B communicate with A, So that A can transfer its permission to B.

PLS回复,我被困在这里.我想动态获得一些权限.这是最好的主意还是其他任何主意?

PLS reply, I'm stuck here. I want to get some permissions dynamically. Is this the best idea or any other idea?

据我所知,应用程序不一定会向其他应用程序授予权限,但前提是您是这两个应用程序的开发者,但AppB可以从AppA继承权限.如果AppA和AppB都在清单中声明了相同的sharedUserId值(android:sharedUserId ="xyz"),并且AppA和AppB都使用了相同的签名进行了签名,那么就权限而言,Android会将其视为同一应用.因此,例如,AppB可能在未经许可"perm1"的情况下存在于设备上.然后,可以使用"perm1"安装AppA.如果AppA和AppB具有相同的sharedUserId和签名,则在安装AppA时,将授予""perm1".

As far as I know, apps can't necessarily give permissions to other apps, BUT AppB could inherit permissions from AppA IF you are the developer of both apps. If both AppA and AppB declare the same sharedUserId value in their manifest (android:sharedUserId="xyz") AND both AppA and AppB are signed with the same signature, then Android will consider them to be the same app as far as permissions go. So, AppB could exist on the device without permission "perm1" for example. Then, AppA could be installed with "perm1". IF AppA and AppB have the same sharedUserId and signature then, when AppA is installed, AppB will be "granted" "perm1".

我现在还没有测试过,但是我知道它曾经工作过(大约一年前).

I haven't tested this just now, but I know it used to work (as of a year ago or so).