simencodes / react-native-imei Goto Github PK
View Code? Open in Web Editor NEWGet IMEI in React Native apps
License: Other
Get IMEI in React Native apps
License: Other
Please use TelephonyManager.getImei()
instead of TelephoneyManager.getDeviceId()
.
With debugger active app cant access to IMEI and crash. Without debug all works fine.
Error:
getDeviceId: Neither user 10701 nor current process has android.permission.READ_PHONE_STATE.
readException
Parcel.java:1943
(Is android 8, i request permission in componentDidMount and have permission added in manifest), but crash before load javascript code only in debug.
iOS doesn't allow to programatically read out the IMEI.
https://stackoverflow.com/a/19927376
this isn't comprehensible from the README. In fact iOS wasn't even mentioned.
HI ,
I did all process and added 'READ_PHONE_STATE' permission as well. My code is as following
const IMEI = require('react-native-imei')
console.log(IMEI.getImei());
``` then i am getting **Module 'react-native-imei' does not exist in the haste module map**
java.util.concurrent.ExecutionException: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
Output: ..\node_modules\react-native-imei\android\build\intermediates\res\merged\release\values-v28\values-v28.xml:7: error: resource android:attr/dialogCornerRadius not found.
..\node_modules\react-native-imei\android\build\intermediates\res\merged\release\values-v28\values-v28.xml:11: error: resource android:attr/dialogCornerRadius not found.
..\node_modules\react-native-imei\android\build\intermediates\res\merged\release\values\values.xml:957: error: resource android:attr/fontVariationSettings not found.
..\node_modules\react-native-imei\android\build\intermediates\res\merged\release\values\values.xml:958: error: resource android:attr/ttcIndex not found.
error: failed linking references.
I have this issue when attempt to ./gradlew assembleRelease
Can you guide me how to fix this issue?
I have followed the doc to extract device imei. Tried every approach I found on stack overflow but it is still giving me this when i uninstall this library my project builds succesfully. Below is the full log.
FAILURE: Build failed with an exception.
Could not create task ':react-native-imei:compileDebugJavaWithJavac'.
In order to compile Java 9+ source, please set compileSdkVersion to 30 or above
Run with --stacktrace option to get the stack trace.
Run with --debug option to get more log output.
Run with --scan to get full insights.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/8.0.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 1m 51s
Here is my build.gradle:
buildscript {
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
ndkVersion = "23.1.7779620"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
}
}
Let me know if anything else is needed.
Android 7.1.2
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
...
When I built my project after linking react-native-imei, I got an error : method does not override or implement a method from a supertype
@OverRide
^
1 error
:react-native-imei:compileReleaseJavaWithJavac FAILED
I got this issue in debug mode on Android simulator
Attempt to invoke virtual method 'java.lang.String java.lang.String.trim()' on a null object reference
getConstants
RNImeiModule.java:31
getConstants
JavaModuleWrapper.java:140
run
NativeRunnable.java
handleCallback
Handler.java:790
.....
Task :react-native-imei:verifyReleaseResources FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':react-native-imei:verifyReleaseResources'. > 1 exception was raised by workers: com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed E:\MyApps\sun-mobile-android\node_modules\react-native-imei\android\build\inte rmediates\res\merged\release\values-v28\values-v28.xml:7: error: resource androi d:attr/dialogCornerRadius not found. E:\MyApps\sun-mobile-android\node_modules\react-native-imei\android\build\inte rmediates\res\merged\release\values-v28\values-v28.xml:11: error: resource andro id:attr/dialogCornerRadius not found. E:\MyApps\sun-mobile-android\node_modules\react-native-imei\android\build\inte rmediates\res\merged\release\values\values.xml:2714: error: resource android:att r/fontVariationSettings not found. E:\MyApps\sun-mobile-android\node_modules\react-native-imei\android\build\inte rmediates\res\merged\release\values\values.xml:2715: error: resource android:att r/ttcIndex not found. error: failed linking references. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:comm and_line_warnings BUILD FAILED in 5m 32s 298 actionable tasks: 2 executed, 296 up-to-date
--
info React Native Environment Info: System: OS: Windows 10 CPU: (4) x64 Intel(R) Core(TM) i5-3437U CPU @ 1.90GHz Memory: 2.22 GB / 7.87 GB Binaries: Yarn: 1.15.2 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD IDEs: Android Studio: Version 3.4.0.0 AI-183.6156.11.34.5522156
Build versions
build failed on making release apk . Please help me i'm stuck on this
Ola senhores, alguém encontrou alguma solução para captura do EMEI no Android 10?
Estou recebendo o retorno null
Do not manually open permissions to resolve, how to deal with it
When running on an emulator, this library returns an array containing a single null. It should reject the promise since there's no IMEI available.
The documentation for TelephonyManager.getImei
says "Return null if IMEI is not available." I'm assuming this is where the null is coming from. If that's the case, then it can occur even when not using an emulator.
Android 10 required a new permission to get IMEI numbers: READ_PRIVILEGED_PHONE_STATE
https://developer.android.com/about/versions/10/privacy/changes
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.