Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/225.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
另一种方法是在使用ANDROID_ID时删除安全警告,以及如何获取设备ID?_Android_Android Security - Fatal编程技术网

另一种方法是在使用ANDROID_ID时删除安全警告,以及如何获取设备ID?

另一种方法是在使用ANDROID_ID时删除安全警告,以及如何获取设备ID?,android,android-security,Android,Android Security,公共静态字符串getDeviceID(上下文mContext){ 这显示了一个安全警告 “不建议使用“getString”获取设备标识符” 如何解决此警告?您无法真正“解决”此警告 如果可能的话,Lint正试图将您从android ID移动到广告ID,因为对于大多数用例来说,这对用户来说都是更好的。如果您想禁用警告@SuppressLint(“硬件ID”),请注意这一点 String deviceId = Settings.Secure.getString(mContext.getCon

公共静态字符串getDeviceID(上下文mContext){

这显示了一个安全警告

“不建议使用“getString”获取设备标识符”

如何解决此警告?

您无法真正“解决”此警告

如果可能的话,Lint正试图将您从android ID移动到广告ID,因为对于大多数用例来说,这对用户来说都是更好的。如果您想禁用警告
@SuppressLint(“硬件ID”)
,请注意这一点

    String deviceId = Settings.Secure.getString(mContext.getContentResolver(),
            Settings.Secure.ANDROID_ID);
    return deviceId;
}