安卓手机连接wifi,在路由器上显示的名字是android_XXXXXXXXXX,想修改在网上找到一段教程,很遗憾没明白怎么弄,征求高手指导一下。
========教程如下========
wifi连接AP后,在AP端看到的设备名保存在prop属性net.hostname中,可以通过getprop net.hostname来查看,通过setprop net.hostname来修改。
默认系统会给一个名字。
frameworks/base/services/java/com/android/server/ConnectivityService.java中生成 :
// setup our unique device name
String id = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
if (id != null && id.length() > 0) {
String name = new String("android_").concat(id);
SystemProperties.set("net.hostname", name);
}
如果需要自己定义,可以注释掉这一段,然后在system.prop中定义 net.hostname=xxxxxx
需要注意的是hostname不能带空格,不然dhcp那边会有问题。