A simple plugin to read a string from Info.plist on iOS and strings.xml on Android
- Android
- iOS
Current release
npm install capacitor-read-native-setting
Run:
npx cap sync ios
After you install the plugin, locate your MainActivity.java (can be found in /android/app/src/main/java/path/to/my/app/MainActivity.java)
Import the class and add
// import thhe class
import com.ingageco.readnativesetting.CapacitorReadNativeSetting;
// add class inside bridge activity:
add(CapacitorReadNativeSetting.class);
Finally, run:
npx cap sync android
At the top of your file import Capacitor Plugins and this extract this plugin
import { Plugins } from '@capacitor/core';
const { CapacitorReadNativeSetting } = Plugins;
- Retrieve a string by key
CapacitorReadNativeSetting.read({ key: 'STRING_KEY_NAME'})
.then((res) => {
// print the value of the setting
// res.value
});