简体   繁体   中英

How to get MAC Adress on expo project react native?

***when i want to get mac adress using expo.NETWORK, it asks for *** "hundling promises" code: ` const ipAlert = async () => { try {

      const ip = await Network.getMacAddressAsync('wlan0')()
    
  } catch (error) {
    console.log('That did not go well.')
  }
  };`

The getMacAddressAsync() call returns a promise, which you need to handle like this:

Network.getMacAddressAsync()
        .then(macAddress => {
             console.log(macAddress)
         })
         .catch(error => console.log(error))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM