简体   繁体   English

重新安装后不要求Android权限

[英]Android permissions not requested after reinstall

I am testing my Android app on my own phone. 我正在用自己的手机测试Android应用。 When I first run it on my phone, it asks for permission to user my gmail account. 当我第一次在手机上运行它时,它会请求用户使用我的Gmail帐户。 When I reinstall my app, it no longer does that? 当我重新安装我的应用程序时,它不再这样做了吗? I would like to make it so that it re-requests permission every time I reinstall the app for testing purposes. 我想这样做,以便每次我出于测试目的重新安装该应用程序时都重新请求权限。 If, on the other hand, I change the package name, it re-requests the permission. 另一方面,如果我更改了程序包名称,它将重新请求权限。 Does anyone know how to do that? 有谁知道这是怎么做到的吗? Much help would be appreciated! 非常感谢您的帮助!

Thanks! 谢谢!

Note: By reinstall, I mean both pressing the run button and actually resinstalling the application by first uninstalling via settings. 注意:通过重新安装,我的意思是既要按下“运行”按钮,又要通过先通过设置进行卸载来实际重新安装应用程序。

This is not an actual Android permission, it's actually an account access grant specific to AccountManager. 这不是实际的Android权限,实际上是特定于AccountManager的帐户访问权限。 Technically, when you uninstall an app all grants should be cleared, but this appears broken on some devices. 从技术上讲,当您卸载应用程序时,应清除所有授权,但是在某些设备上这似乎已损坏。 If you have a rooted device or are using the emulator, you can find accounts.db (usually in /data/system/users/0/accounts.db on newer versions) and clear the grants and extras tables (that could affect other apps, so handle with care). 如果您拥有root用户的设备或正在使用模拟器,则可以找到accounts.db(通常在较新版本的/data/system/users/0/accounts.db )并清除grants和extras表(这可能会影响其他应用程序) ,因此请谨慎处理)。 If you don't, clearing the data for Google Account Manager and Google Play Services could help. 如果不这样做,清除Google Account Manager和Google Play服务的数据可能会有所帮助。

What do you mean by reinstall? 重新安装是什么意思? Does reinstall simply meaning pressing the "run" button? 重新安装只是意味着按下“运行”按钮吗? Or are you actually uninstalling and reinstalling the application. 或者您实际上是在卸载并重新安装该应用程序。 Once the Android OS detects that a permission is needed, it will request it from the user. 一旦Android OS检测到需要许可,它将向用户请求许可。 But after that first time, it won't ask again. 但是第一次之后,它就不会再询问了。 If you completely uninstall the application from the device and then reinstall, it should work. 如果您从设备上完全卸载了该应用程序,然后重新安装,它应该可以工作。 I don't know of any other way you can bypass that. 我不知道有什么其他方法可以绕开它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM