Get MAC address using phonegap or Apache Cordova

MAC Address stands for Media Access Control which is an unique identifier for network communication on physical network component.In this tutorial, we’re going to learn how to get mac address using phonegap. we use Mac Address Plugin

how to get MAC address using phonegap ?

Step 1 : Create new phonegap project / use existing phonegap project

cordova create MacAddressExample com.phonegap.macaddress MacAddressExample

Step 2 : Change Working Directory

cd MacAddressExample

Step 3 : Add Platform

cordova platform add android

Step 4 : Add Plugin

cordova plugin add https://github.com/mohamed-salah/MacAddress.git

Step 5 : Add this code for get mac address


window.MacAddress.getMacAddress(
function(macAddress) {alert(macAddress);},function(fail) {alert(fail);}
);

This code will alert your mac address

Download Code

Download APK

  • mlubbad

    Hi SUNDARAVEL,
    I test your code on iOS, but its not working correctly.
    Please find the attachment below ..

Share This

Share this post with your friends!