There is nothing to say, directly on the code:
1 Public classPhonestatecodeutils {2 /**3 * Get IMEI serial number of phone4 */5 Public StaticString Getimei (context context) {6Telephonymanager TM =(Telephonymanager) Context.getsystemservice (context.telephony_service);7 //Device String Number8String IMEI =Tm.getdeviceid ();9 returnIMEI;Ten } One A /** - * Get phone IP - * the * @return - */ - Public StaticString Getphoneip () { - Try { + for(Enumeration<networkinterface> en =networkinterface.getnetworkinterfaces (); en.hasmoreelements ();) { -NetworkInterface intf =en.nextelement (); + for(Enumeration<inetaddress> enumipaddr =intf.getinetaddresses (); enumipaddr.hasmoreelements ();) { AInetAddress inetaddress =enumipaddr.nextelement (); at if(!inetaddress.isloopbackaddress () && inetaddressinstanceofinet4address) { - //if (!inetaddress.isloopbackaddress () && inetaddress - //instanceof Inet6address) { - returninetaddress.gethostaddress (). toString (); - } - } in } -}Catch(Exception e) { to } + return"127.0.0.1"; - } the *}
Get the phone IMEI number and IP