
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
react-native-system-settings
Advanced tools
Provides accessing some Android system setting values like localization, language, country, simCountry, networkCountry, timeZone, is24HourFormat, oritentation, screen layout and ui mode type.
This module has been prepared by according to Android Configuration class; https://developer.android.com/reference/android/content/res/Configuration.html
country value of localization object may be tricky in Android systems. To find the certain user country you might check simCountry and networkCountry values of localization object.iOS would also be great.npm i --save react-native-system-settings in the console.$ rnpm link react-native-system-settings
react-native run-androidRun the command of npm i --save react-native-system-settings in the console.
In your settings.gradle add the lines below:
include ':systemsettings'
project(':systemsettings').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-system-settings/android')
In your android/app/build.gradle add the following line:
dependencies {
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+"
compile project(':systemsettings') // <-- Add this line
}
The package needs to be provided in the getPackages method of the MainActivity.java file. This file exists under the android folder in your react-native application directory. The path to this file is: android/app/src/main/java/com/your-app-name/MainActivity.java.
import com.systemsettings.SystemSettingsPackage; // <-- Add this line
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new SystemSettingsPackage() // <-- Also add this line
);
}
And finally run the command of react-native run-android
Define a new module variable by using ES6 syntax;
import SystemSettings from 'react-native-system-settings';
or by using require method;
var SystemSettings = require('react-native-system-settings');
then system settings can gotten in somewhere in code:
SystemSettings.get(
settings => console.log('settings: ', settings)
)
Also promise-then can be used:
SystemSettings.get().then(settings => console.log('settings: ', settings)).done()
Also ES7 async-await method can be used!
class App extends React.Component {
componentWillMount() {
this._loadInitialState()
}
_loadInitialState = async () => {
try {
let settings = await SystemSettings.get()
// Now settings variable would be filled and can be used!
} catch (error) {}
};
}
Sample result from Galaxy S3 (Genymotion);
```
{
densityDpi: 320,
fontScale: 1,
hardKeyboardHidden: "no",
keyboard: "qwerty",
keyboardHidden: "no",
localization: {
country: "US",
displayCountry: "United States",
displayLanguage: "English",
displayName: "English (United States)",
is24HourFormat: false,
language: "en",
locale: "en_US",
networkCountry: "US",
simCountry: "US",
timeZone: {
ID: "Europe/Amsterdam",
displayName: {
long: "Amsterdam Standard Time",
short: "GMT+01:00",
},
offset: 3600000
}
},
orientation: "portrait",
screenHeightDp: 615,
screenLayout: "normal",
screenWidthDp: 360,
smallestScreenWidthDp: 360,
uiModeType: "normal"
}
```
true and false values
localization.language: One of 'en', 'de', 'fr', 'tr', ... strings (The MIT License)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
Provides accessing some Android system setting values like localization, language, country, simCountry, networkCountry, timeZone, is24HourFormat, oritentation, screen layout and ui mode type.
The npm package react-native-system-settings receives a total of 10 weekly downloads. As such, react-native-system-settings popularity was classified as not popular.
We found that react-native-system-settings demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.