Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple way to get the bundle identifier at runtime in React Native?

Tags:

react-native

We've hit a problem that could be solved if we know the bundle identifier at run time in our RN app. We've seen a few libraries but would rather not include a whole library to do this one thing. Is there a simple way to get this information in the code?

Thanx

like image 409
Kevin Avatar asked Jan 03 '19 17:01

Kevin


People also ask

How do I Find my React Native iOS Project Bundle ID?

To find your react native iOS project Bundle ID first open your iOS react native project in MAC. 2. Select the iOS folder . 3. Open the file named as Your_Project_Name.xcodeproj in XCODE.

How to change bundle identifier in React-Native project?

If you want to change bundle identifier in react-native project. You must have to change app identifier separately for both side android and ios. Goto your AndroidManifest.xml. Just place your cursor in the package name, don't select it just place it.

What files have to be changed in React-Native to work on Android?

Based on the react-native version you are using there are bunch of files that have to be changed on both platforms (android and ios) [application_build_scheem] .plist (this is a dict/xml file that contains keys that are used by default if no changes added to project (react-native-cli init type of project)

How to get the bundle identifier of an application?

You can get the bundle identifier from Application. persistentDataPath at least on Android. My colleague suggested this idea. Thank you for the plugin. I'll try that out and I guess try to make one for the Android side as well. Still seems very ridiculous to need to create a plugin to access a key component of an application run-time.


1 Answers

on mac you can see it inside general Tab enter image description here

you can also use

import DeviceInfo from "react-native-device-info";

console.log("@ device   ",DeviceInfo.getBundleId())
like image 88
Fadi Abo Msalam Avatar answered Jan 01 '23 09:01

Fadi Abo Msalam