简体   繁体   English

如何在 expo 中获取设备 ID 反应原生应用程序

[英]How to get device Id in expo react native app

I am implementing API to connect app with server.我正在实施 API 以将应用程序与服务器连接。 I have to use deviceId there.我必须在那里使用 deviceId。 As mentioned in here we can use third party library 'react-native-device-info'.正如这里提到的,我们可以使用第三方库“react-native-device-info”。 But when I am using it I am getting errors as attached screenshots.但是当我使用它时,我收到了附加截图的错误。 As per error it's saying to do linking but as I am using react version 0.62, so autolinking is there.根据错误,它说要进行链接,但由于我使用的是反应版本 0.62,因此存在自动链接。 So What can be issue?那么可能是什么问题? It took too much time to search it but till now I didn't get a proper solution.搜索它花了太多时间,但直到现在我还没有找到合适的解决方案。

在此处输入图像描述

react-native-device-info library wont work in Expo, since it requires linking of native modules hence the error.It will only work in pure react native apps. react-native-device-info 库在 Expo 中不起作用,因为它需要链接本机模块,因此会出现错误。它仅适用于纯反应本机应用程序。

You can check this by expo itself: expo-device您可以通过 expo 本身进行检查: expo-device

hopeit helps.feel free for doubts希望对您有所帮助。如有疑问,请随意

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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