-
Notifications
You must be signed in to change notification settings - Fork 516
Expo
aliberski edited this page Jan 9, 2025
·
1 revision
// app.json
{
"expo": {
"plugins": [
[
"react-native-ble-plx",
{
"isBackgroundEnabled": true,
"modes": ["peripheral", "central"],
"bluetoothAlwaysPermission": "Allow $(PRODUCT_NAME) to connect to bluetooth devices"
}
]
]
}
}
- Make sure your Expo project is ejected (formerly: detached). You can read how to do it here. (only for Expo SDK < 43)
- Follow steps for iOS/Android.
Expo allows translating metadata by adding "CFBundleAllowMixedLocalizations": true
. We can localize the bluetooth permission message in a following way:
// app.json
{
"expo": {
"plugins": [
[
"react-native-ble-plx",
{
"isBackgroundEnabled": true,
"modes": [
"peripheral",
"central"
]
}
]
],
"ios": {
"infoPlist": {
"CFBundleAllowMixedLocalizations": true
}
},
"locales": {
"en": "./en.json",
"de": "./de.json"
}
}
}
// en.json
{
"NSBluetoothAlwaysUsageDescription": "We need Bluetooth to connect to devices."
}
// de.json
{
"NSBluetoothAlwaysUsageDescription": "Wir benötigen Bluetooth, um eine Verbindung zu Geräten herzustellen."
}