Search Unity

[RELEASED] Find MAC address on Android

Discussion in 'Assets and Asset Store' started by Lucasito, Apr 17, 2019.

  1. Lucasito

    Lucasito

    Joined:
    Mar 22, 2013
    Posts:
    80
    This asset only for Android.
    Find Wi-Fi MAC address. Worked on Android 4, 5, 6, 7, 8. Worked on Oculus GO with Android 7.1
    If it does not work, write me, fix it. Asset has an example scene.
    DEMO Apk for check on device: http://info.littlestories.ru/FindMAC.apk


    Test guide

    1. Create a new empty project.
    2. Import the package (Assets/Import Package/Custom Package).
    3. Open and add in Build Settings demo scene Assets/MobileLocalNotifications/Scenes/Demo.unity.
    4 Build project to android device.
    5. Start project.


    Using the plugin

    FindMACClass.GetMACAddress() return string with MAC address.

    banner.png
    2.png
     
  2. zkkzkk32312

    zkkzkk32312

    Joined:
    Nov 4, 2016
    Posts:
    5
    Not working with Quest?
    Tried to run the demo apk with a quest and it did not even show up under "Unknown Source" apps.
     
  3. Lucasito

    Lucasito

    Joined:
    Mar 22, 2013
    Posts:
    80
    Sorry, but I don't have access to this device :(
    How could you work together to check?
     
  4. bakno

    bakno

    Joined:
    Mar 18, 2007
    Posts:
    604
    I just purchased this plugin. Tried to write an email but did not find it on the asset store or on the ReadMe within the package.

    After installing the plugin, the application has the GPS permission. Is this permission necessary? Can you please remove it from the plugin manifest?

    Thank you
    Andres
     
  5. Lucasito

    Lucasito

    Joined:
    Mar 22, 2013
    Posts:
    80
    Hi!
    Sorry, but since Android 6:
    ----
    To provide users with greater data protection, starting in this release, Android removes programmatic access to the device’s local hardware identifier for apps using the Wi-Fi and Bluetooth APIs. The WifiInfo.getMacAddress() and the BluetoothAdapter.getAddress() methods now return a constant value of 02:00:00:00:00:00.

    To access the hardware identifiers of nearby external devices via Bluetooth and Wi-Fi scans, your app must now have the ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION permissions.
    ----
    Original https://developer.android.com/about...android-6.0-changes.html#behavior-hardware-id
     
  6. alsch1230_unity

    alsch1230_unity

    Joined:
    Mar 27, 2020
    Posts:
    3
    Imported to version 2020.3.21, but the manifest file does not exist
     
  7. Lucasito

    Lucasito

    Joined:
    Mar 22, 2013
    Posts:
    80
    I compiled demo on Unity 2020.3.23. Can you show what kind of error you are getting?
     
  8. alsch1230_unity

    alsch1230_unity

    Joined:
    Mar 27, 2020
    Posts:
    3
    I added ACCESS_FINE_LOCATION to my manifest file and called the FindMAC.Scripts.FindMACClass.GetMACAddress() method after building, but nothing is returned. No rogcat errors were found

    Build Target is 30
     
    Last edited: Feb 16, 2022
  9. Lucasito

    Lucasito

    Joined:
    Mar 22, 2013
    Posts:
    80
    Thanks for the information. It turns out that in Android 11 (target 30) this feature was disabled :( If you set target 29, then it works.
    https://developer.android.com/training/articles/user-data-ids#mac-addresses
     
  10. alsch1230_unity

    alsch1230_unity

    Joined:
    Mar 27, 2020
    Posts:
    3