how to get mac address

cwt

Active Member
Licensed User
Longtime User
I am creating an in house app to communicate with a soap server. In the app setup the user saves his username and password which is sent to the server for verification when he posts soap packets. I want further validation of the user and thought maybe sending the device phone number to be used for validation on the server but then tablets don't have phone number and I want the app to be used on both phones and tablets. So I figure every device will have a MAC address.

How do I get the MAC address of the Android device? I did a search and did not find an answer.

Of course, the MAC address will need to be saved in the users profile on the server so it can be compared to the device MAC address.

Thanks
 

cwt

Active Member
Licensed User
Longtime User
yes - you are right - the phone, or maybe even the tablet, may not have wi-fi and would not have a mac address. But does a tablet have an Android ID? I need a unique device identifier whether the device is a phone or a tablet.

Thanks
 
Upvote 0

salmander

Active Member
Licensed User
Longtime User
That ID is unique to all devices and all devices have it.
it is giving me the following error when I try to compile
B4X:
Compiling code.                         Error
Error compiling program.
Error description: Unknown member: getsettings
I am using Phone v1.75 lib.
 
Upvote 0

salmander

Active Member
Licensed User
Longtime User
Sorry my bad, its solved.
i was using p as phoneId. And not Phone. I changed it to phone...and its working...

Thanks.
 
Upvote 0

jiangws

Member
Licensed User
Longtime User
You can use ABWifi library.

ABWifi library can get mac address.
 
Upvote 0

madSac

Active Member
Licensed User
Longtime User
That ID is unique to all devices and all devices have it.

I don't think.
Once while rooting my phone i bricked it :sign0137: .I downloaded original version by the device vendor then then unbricked it using Odin. When i checked old android id in a file i made and current android id both were different and changed.There are millions of android devices may be this new id will match any.

Since then i tried 2-3 times all times android id's were different.So i think that it is not unique for all devices it doesn't depends upon hardware.

And probably MAC address's are also changed and even they can be changed using superuser permission.
 
Upvote 0

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User

Hi NJDude,
the p.GetSettings("android_id") method, don't return me the MAC address.
How can I get it?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…