Unable to fetch IMEI number of a mobile device using React-Native

911 Views Asked by At

I have type-script code for a mobile app. I want to fetch the IMEI code of the device when I log into the app. I have linked react-native-imei (android) library with react-native successfully, but when I add following code at login, I do not get the number: const IMEIObj = require('react-native-imei');

IMEIObj.getImei().then((imeiList: any) => {
    console.log("imei", imeiList); // prints ["AABBBBBBCCCCCCD"]
}) 

Instead I get the following error: TypeError: null is not an object (evaluating 'ReactNative.NativeModules.IMEI.getImei')

I have been on this for 2 days, but couldn't move ahead. Can you please help me here? Thanks.

0

There are 0 best solutions below