Hi i am trying to find all devices connected to My WIFI Router from android and ,i need to device Mac address and local ip address of each device (Including iOT Devices) ,
Actually, you only need to ping the broadcast address of the device's network to make the ICMP ECHO request go to every and each machine on the network. No need to ping separately. On the other hand, some devices don't respond to pings like these as a "security precaution". It's up to you.
Then, do what the code in the other answer does - parse /proc/net/arp
which contains the ARP cache. From that special file in procfs you will find out the MAC addresses of network devices in your network. (Posting this as an answer because I do not have enough reputation yet to add this as a comment to the other answer)