Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

548
Views
Get IMEI number in React Native

I need IMEI for validation in a React Native app. Using reactive-native-imei package, here is the link to that package: (https://github.com/SimenCodes/react-native-imei).

during my code I am getting the following errors:-

  1. In my Code here;
const GetImei = () => {
    const IMEI = require('react-native-imei');
    IMEI.getImei().then(imeiList => {
        console.log(imeiList); // prints ["AABBBBBBCCCCCCD"]
    });

In the second line of my code const IMEI = require('...react-native-imei'); It is giving me that 3 dots below 'r' of react-native-imei and when I hover over it, it's saying "could not find declaration file for module- 'react-native-imei' ", though I have installed the package and also linked it, I also checked In the node-module the package is still there also I have checked settings.gradle file the package is included there so what could be the reason of this error? please help me.

  1. some other errors I am getting are given in the below images: enter image description here enter image description here enter image description here
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

check this issue. It is raised in library.

https://github.com/SimenCodes/react-native-imei/issues/22

If you are in a very particular situation, you can use this library in recent Android versions as well. "Just" follow Android's rules for obtaining the extra permission. There's some hints in the discussion from 2019, but you should know that the permission has been renamed to READ_PRECISE_PHONE_STATE since then.

check in android documentation also.

https://developer.android.com/about/versions/10/privacy/changes?authuser=1#non-resettable-device-ids

about 4 years ago · Juan Pablo Isaza Report

0

I dont actually know what exactly caused the error in your application but I have build a demo base on your given library and it works fine. Here is my code :

import React from 'react'
import { StyleSheet,TouchableOpacity ,Text,View} from 'react-native'

export default class Demo extends React.Component {

  constructor () {
    super()
    this.state = {
      deviceIMEI: '',
    }
  }

  getIMEI = () => {
    const IMEI = require('react-native-imei')
    this.setState({
      deviceIMEI: IMEI.getImei(),
    })
  }

  render () {
    return (
      <View style={styles.container}>
        <Text>{this.state.deviceIMEI}</Text>
        <TouchableOpacity onPress={this.getIMEI}>
          <Text>Get Current Device IMEI</Text>
        </TouchableOpacity>
      </View>
    )
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'flex-start',
  },
})
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!