I know this question has been asked several times but there isn't a proper code snippet or answer in SO.
I am developing an android app which gives the list of MAC addresses (IP address or device name anything ,etc. ) of all the Devices connected to a wifi network (the network in which the mobile containing this app is installed).
Is there any API's in android to achieve this or else how can we do this.
Note : Please provide the answer with a code snippet
I think that it is not possible to get Mac Address of other devices. However you can get IP addresses.
Related
I am developing an application in which I require to send my Bluetooth MAC address to the server and also I am searching for the nearby Bluetooth devices and sending the list of their Bluetooth MAC address to the server. On the server end I use this information to filter out the android devices that I need from the other devices. But I can not find a way to find out the Bluetooth MAC address of my own device but I can see the MAC addresses of the other devices.
Can anyone please help me with this issue? If you are not able to tell how to get the MAC address can you suggest some other method by which I can do this. I am basically trying to create a contact tracing application which works via Bluetooth.
Can I uniquely identify each android device using its Bluetooth LE Mac address?
Does this MAC address changes on reboot?
How can I get my own device's Bluetooth LE MAC address?
Any suggestion on this will be great help for me.
Thanks!
This Stack Overflow answer answers your questions pretty well.
I haven't tried this myself but it looks like you can access the MAC address with BluetoothDevice.getAddress() (Android API reference here).
In case you are working with iOS too, you cannot access a BLE device's MAC address; see this post on Apple's Developer forum.
If you control the firmware of the device you are connecting to, you could name each device uniquely or put a unique identifier in the advertisement/scan response data. If you don't control the firmware of the device you are connecting to, it's possible that the manufacturer has done something like this.
Hope this helps!
Obtain a List of IP addresses of all available android Devices.
Establish connection with one of IP.
Send Data to the Selected IP?.
If any body done this already, a little help would be great.
I guess you have to search for devices on your WiFi network. Then create a list with the devices (IP-addresses) you found. If you click on a device, send the data to the IP that belongs to that device.
To detect wether or not any device you find in the network is an Android device, is something else.
This article might be helpful to get you started, along with its subarticles: http://developer.android.com/training/connect-devices-wirelessly/index.html
Programmatically, I got Mac addresses of other Wifi enabled devices from my device on the same network. Same I need to apply here. Is there any apps or any other possibilities to get an IP addresses of each wifi enabled devices on the network by using those Mac addresses on Android?
If you're looking for an android app, you could try Network Discovery which work very well and can list all the devices on your local network with the corresponding IP and address.
If you're looking for code instead, well the application is available on github and does (amongst other things ) basically the same thing than explained by Yahel : it reads /proc/net/arp .
Note : I'm NOT the author of this application.
This person does the exact opposite so it should work for you.
The trick is to read the ARP cache table from the device.
http://www.flattermann.net/2011/02/android-howto-find-the-hardware-mac-address-of-a-remote-host/
I was wondering if Android phones have a MAC address when connected to the internet over 3G? I'm assuming they do, so I guess my real question is whether or not there is anyway of accessing it? I haven't found anything from looking through the APIs or by googling, but maybe I missed something.
Thanks in advance
MAC address is specific to network technologies that implement the IEEE 802 standard, such as ethernet. 3G is not an IEEE 802 network, so MAC address really doesnt apply.
That said, there should be very few reasons to use the MAC address in your app, unless youre writing a network driver or doing something specific with the TCP/IP network.
Often people reach for MAC address thinking that it represents a unique device id, when really you should use something like http://developer.android.com/reference/android/provider/Settings.Secure.html#ANDROID_ID to get a unique id that will work across all of the different hardware combinations for android, some of which might include no IEE 802 network whatsoever.
I have never seen any reference to a 3G MAC address anywhere. The closest thing to a 3G MAC address that I know of is the IMEI/MEID code.
android.telephony.TelephonyManager.getDeviceId() will return the IMEI/MEID code.
If you are trying to uniquely identify app installs then see: http://android-developers.blogspot.com/2011/03/identifying-app-installations.html