Read info.plist and strings.xml
npm install capacitor-config-readerSimple plugin to read values from info.plist on iOS and strings.xml on Android.
``bash`
npm install capacitor-config-reader
npx cap sync
`typescript
import { ConfigReader } from 'capacitor-config-reader';
// Read a string resource from strings.xml
const result = await ConfigReader.readStringResource({ key: 'app_name' });
console.log(result.value); // Outputs the value from strings.xml
`
`typescript
import { ConfigReader } from 'capacitor-config-reader';
// Read a value from Info.plist
const result = await ConfigReader.readInfoPlistValue({ key: 'CFBundleDisplayName' });
console.log(result.value); // Outputs the value from Info.plist
`
`xml`
`xml`
#### Android strings.xml
The plugin can read any string resource defined in your android/app/src/main/res/values/strings.xml file. Common keys include:
- app_name - The application nametitle_activity_main
- - Main activity titlepackage_name
- - Package identifiercustom_url_scheme
- - Custom URL scheme
#### iOS Info.plist
The plugin can read any key defined in your ios/App/App/Info.plist file. Common keys include:
- CFBundleDisplayName - The application display nameCFBundleIdentifier
- - The bundle identifierCFBundleShortVersionString
- - The app versionCFBundleVersion
- - The build number
* echo(...)
* readStringResource(...)
* readInfoPlistValue(...)
`typescript`
echo(options: { value: string; }) => Promise<{ value: string; }>
| Param | Type |
| ------------- | ------------------------------- |
| options | { value: string; } |
Returns: Promise<{ value: string; }>
--------------------
`typescript`
readStringResource(options: { key: string; }) => Promise<{ value: string; }>
| Param | Type |
| ------------- | ----------------------------- |
| options | { key: string; } |
Returns: Promise<{ value: string; }>
--------------------
`typescript`
readInfoPlistValue(options: { key: string; }) => Promise<{ value: string; }>
| Param | Type |
| ------------- | ----------------------------- |
| options` | { key: string; } |
Returns: Promise<{ value: string; }>
--------------------