react native run on a particular emu 1

react native run on a particular emu

npx react-native run-android --deviceId=DEVICE_ID
npm run android -- --deviceId=DEVICE_ID

To see available devices ids:
adb devices//emulator-????

Here is what the above code is Doing:
1. We’re importing the react-native-device-info package.
2. We’re creating a DeviceInfo class that extends the Component class.
3. We’re creating a state object that has a deviceId property.
4. We’re using the getUniqueID() method from the react-native-device-info package to get the device ID.
5. We’re setting the deviceId property of the state object to the device ID.
6. We’re rendering the device ID to the screen.

Similar Posts