为什么我的应用要求手机ID许可? [英] Why is my app asking for phone id permission?

查看:232
本文介绍了为什么我的应用要求手机ID许可?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的表现我只要求这两个权限:

In my manifest I only ask for these two permissions:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

但是,当我安装我的手机上的应用程序我也得到这个通知:

But when I install the app on my phone I also get this notice:

Low-risk permissions
Phone ID
Get your phone ID, including IMEI, IMSI, etc.

这是我从收集这些SO回答,我需要使用 TelephonyManager 和呼叫

From what I gather from this SO answer, I should need to use TelephonyManager and call

<uses-permission android:name="android.permission.READ_PHONE_STATE" />

需要此权限。但我没有使用TelephonyManager或调用的权限。我不想要求用户给这个权限。我已经通过我的清单和文件的gradle看着。会不会是一些code我曾经引发被称为此权限没有我专门询问呢?我知道我不会给你很多去,通过我不知道还有什么地方找。

to require this permission. But I'm not using TelephonyManager or calling that permission. I don't want to ask users to give this permission. I've looked through my manifest and gradle files. Could it be that some code I used triggered this permission being called without me specifically asking for it? I know I'm not giving you a lot to go on, by I don't know where else to look.

更新1

我创建Android Studio中一个全新的项目,并从它生成一个签名APK。我安装了它,但没有权限被要求。 (至少证实了我,这是不是有些新功能Android Studio中自动要求此权限。)

I created a completely new project in Android Studio and generated a signed APK from it. I installed it but no permissions were asked. (That at least confirmed for me that it wasn't some "new feature" in Android Studio that automatically asked for this permission.)

更新2

作为@安东尼的回答,我发现应用程序/建设/输出/日志/清单合并释放-REPORT.TXT 但是,我没有找到任何隐含权限被请求。

As of @antonio's answer I found app/build/outputs/logs/manifest-merger-release-report.txt However, I didn't find any implied permissions being requested.

更新3

下面是我的应用程序使用(从gradle.build)的依赖:

Here are the dependencies my app is using (from gradle.build):

dependencies {
    compile 'com.android.support:support-v4:21.0.3'
    compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
}

我测试了这两个依赖新的应用程序,并已要求没有任何权限。

I tested a new application with both of these dependencies and no permissions were requested.

我的下一步就是要从头开始重新添加的每一次活动,看看我能在哪里找到此权限开始变得调用。未完待续...

My next step is to add every activity again from scratch and see if I can find where this permission starts getting called. To be continued...

更新4

我打得四处复制一切,一个新的项目和重构项目名称和删除块,但它被证明是相当复杂的。我是不是能够隔离的原因。

I played around with copying everything to a new project and refactoring the project name and removing pieces, but it turned out to be quite complex. I wasn't able to isolate a reason.

更新5

我的targetSdkVersion设置为1,在安装应用程序之前公布的权限时,这给出了一个新的消息:

I set the targetSdkVersion to 1. This gives a new message when announcing permissions before installing the app:

读取手机状态和身份

允许该应用访问设备的电话功能。本
  权限允许应用程序来确定电话号码和设备
  的ID,呼叫是否处于活动状态,并且通过连接的远程号
  呼叫。

Allows the app to access the phone features of the device. This permission allows the app to determine the phone number and device IDs, whether the call is active, and the remote number connected by a call.

这是我一开始写的旧手机ID许可通知仍然存在(显示出来安装应用程序后)。这使我不知道它是与操作系统(我使用MIUI Android的一个小蜜电话)。还有一些关于导致该在这个应用程序,但不能在其他应用程序显示应用程序。我需要测试这一点在其他设备旁边。

The old Phone ID permission notice that I wrote about at the beginning is still there (showing up after the app is installed). This makes me wonder if it is related to the OS (I'm using MIUI Android on a Xiaomi phone). There is still something about the app that causes this to display in this app but not in other apps. I need to test this out on other devices next.

推荐答案

这是因为要导入库与targetSdkVersion比你的应用程序的targetSdkVersion较低

This happens because you are importing a library with a targetSdkVersion lower than your application's targetSdkVersion

从<一个href=\"http://tools.android.com/tech-docs/new-build-system/user-guide/manifest-merger#TOC-Implicit-permissions-addition\">Manifest合并文档:

在导入库与targetSdkVersion比下
  导入应用程序targetSdkVersion, 一些权限可能
  自动添加到合并后的清单文件。

  这是必要的,因为这样的图书馆有针对性的在那里等权限被隐式授予运行时。因此宣称这种许可是没有必要的。然而,在最近的Andr​​oid版本中,这些权限不会自动授予。因此,图书馆等目标运行时老不权限将无法正常工作,一旦合并应用程序中的目标更近的运行时间。

When importing a library with a targetSdkVersion lower than the importing application targetSdkVersion, some permissions maybe automatically added to the resulting merged manifest file. This is necessary since such libraries targeted runtimes where such permissions were implicitly granted. Therefore declaring such permission was not necessary. However in more recent Android releases, these permissions are not automatically granted. Therefore, a library targeting such old runtime without the permissions would not work properly once merged in the application targeting a more recent runtime.

这可添加的权限是:


  • WRITE_EXTERNAL_STORAG​​E 添加导入与targetSdkVersion℃的库时; 4

  • READ_EXTERNAL_STORAG​​E 添加导入声明WRITE_EXTERNAL_STORAG​​E库时

  • READ_PHONE_STATE 添加导入与targetSdkVersion℃的库时; 4

  • READ_CALL_LOG 添加导入与targetSdkVersion℃的库时; 16,用READ_CONTACTS权限

  • WRITE_CALL_LOG 添加导入与targetSdkVersion℃的库时; 16,用WRITE_CONTACTS权限

您可以通过检查清单合并产生(在\\程序\\编译\\输出\\ APK \\清单合并-XXX-报告)的报告,看看有什么库引起READ_PHONE_STATE许可的增加。你会看到类似这样的:

You can inspect the report generated by Manifest Merger (In \app\build\outputs\apk\manifest-merger-XXX-report) to see what library caused the adding of the READ_PHONE_STATE permission. You will see something like:

android:uses-permission#android.permission.READ_PHONE_STATE
IMPLIED from AndroidManifest.xml:2:1 reason: the.library has a targetSdkVersion < 4

这篇关于为什么我的应用要求手机ID许可?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆