How to get Mac address for Android and Android with 6.0 or higher in C #?

I found some examples using Java, however it is difficult for me to create a method for C #. Can someone send a simple C # example that will get the Mac address of my device for Marshmallow (6.0). I understand that there are other methods for obtaining a unique identifier, I am not very interested in importing components at this time. I am using Xamarin with Visual Studio 2015.

I have these permissions active:

ACCESS_WIFI_STATE INTERNET READ_PHONE_STATE

The only codes I've tried are the simple methods used for Android version 6.0. Any help is appreciated.

EDIT: I don't think this is a duplicate, as I specifically requested code for the C # version

+4
source share
1 answer

Unfortunately, you are out of luck. Starting with version 6.0, Android restricts access to the MAC address. If you try to request the MAC address of your current device, you will get a constant value02:00:00:00:00:00

You can access the MAC addresses of nearby devices as indicated in the official Android documentation

To use this in the real world, some zero link checking and other modifications are required, but it works.

+7
source

Source: https://habr.com/ru/post/1654376/


All Articles