Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

549
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda