Tuesday, August 21, 2012

[android-developers] How to find Ip address of a device via wifi?

I wanna get IP address. Using that Ip address must detect overall devices which is connected to a specific network/device.And should be able to get MAC address ? 
Please can anyone help me here ?

This is my code :

 tv=(TextView)findViewById(R.id.tv);   wifi=(WifiManager)getSystemService(WIFI_SERVICE) ;   btn=(Button)findViewById(R.id.btn);   btn.setOnClickListener(new View.OnClickListener() {   @Override   public void onClick(View v) {   try {   InetAddress inet=InetAddress.getLocalHost();   Toast.makeText(getApplicationContext(),inet.toString(),Toast.LENGTH_LONG).show();   } catch (Exception e) {   System.out.println(" ");      }

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate