我想知道手机号码和Wi-Fi地址。这有可能。任何人都可以帮助我
答案 0 :(得分:2)
尝试使用手机号码
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
// get IMEI
String imei = tm.getDeviceId();
String phone = tm.getLine1Number();
但它并非总是可靠的,例如非电话设备。您还需要添加permision“android.permission.READ_PHONE_STATE”。
表示MAC地址
WifiManager wfManager;
WifiInfo wifiinfo;
wfManager = (WifiManager)getSystemService(Context.WIFI_SERVICE);
wifiinfo = wfManager.getConnectionInfo();
String MAC = wifiinfo.getMacAddress();
答案 1 :(得分:0)
public String getMAC() {
wifimanager= (WifiManager)getSystemService(Context.WIFI_SERVICE);
wifiinfo = wifimanager.getConnectionInfo();
MAC=wifiinfo.getMacAddress();
System.out.println("MAC address info---- "+MAC);
Toast.makeText(getApplicationContext(), "MAC address:"+MAC , Toast.LENGTH_LONG).show();
if(MAC==null){
MAC="1A:DC:5C:8E:15:7B";
}
return MAC;
}