Get ethernet Mac

Permission

The application declares the following permissions in the manifest:

 android.permission.ACCESS_NETWORK_STATE

API Overview

byte[] getEth0Mac();

Get Mac of Ethernet.

Returns

byte[]

Mac array.

Snippet Code

private ISystemDevice device;

    private void getEth0Mac(){
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    if (device == null) {
                        device = POSTerminalAdvance.getInstance().getSystemDevice();
                    }
                    device.open(context);
                    byte[] ethMacByte = device.getEth0Mac();
                    device.close();                    
                } catch (DeviceException e) {
                    e.printStackTrace();
                }
            }
        }).start();
    }

Resource Download

  • Refer to the cloudpos apidemo - demo

Last updated