Skip to content

Commit

Permalink
Merge pull request guyromb#9 from emcniece/fix/npm-readme-update
Browse files Browse the repository at this point in the history
Fix/npm readme update
  • Loading branch information
guyromb committed Jul 14, 2017
2 parents 2c48895 + f6ad473 commit fc6f5a5
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
26 changes: 17 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
#NativeSettings plugin for Cordova (6/7)
# NativeSettings plugin for Cordova (6/7)

The plugin allows you to open OS settings on iOS 8/9/10 and Android, via cordova-based app. For example, it will allow you to open the keyboard settings, Wifi, bluetooth etc (full list below).

##Adding/Removing the Plugin
## Adding/Removing the Plugin
It will be saved to the config.xml file

Ionic Framework:

```bash
ionic cordova plugin (add|rm) cordova-open-native-settings --save
```

Cordova:

```bash
cordova plugin (add|rm) https://github.com/guyromb/Cordova-open-native-settings.git --save
cordova plugin (add|rm) cordova-open-native-settings --save
```

or via npm (It will be saved to the package.json file)

```bash
npm (install|rm) https://github.com/guyromb/Cordova-open-native-settings.git --save
npm (install|rm) cordova-open-native-settings --save
```

##Using the plugin (opens Location Settings in Android and Application Settings in iOS)
## Using the plugin (opens Location Settings in Android and Application Settings in iOS)

```
cordova.plugins.settings.open(setting_constant, success_callback, failure_callback);
```

###Example for iOS and Android - open Wifi settings
### Example for iOS and Android - open Wifi settings

```js
if (window.cordova && window.cordova.plugins.settings) {
Expand All @@ -41,7 +49,7 @@ if (window.cordova && window.cordova.plugins.settings) {
In Android, by default it is opened in the same application as a new activity, the hardware back button will bring the user back to the previous activity (the app). In order to open settings as a new application (two applications will appear in "recent/opened" apps list) the following code can be used:
`window.cordova.plugins.settings.open(["wifi", true], function() {}, function() {}); ....`

##Settings Options
## Settings Options
You can use any constant from the following list:
* I tried to map Android and iOS together, however, they are not always the same.

Expand Down Expand Up @@ -115,13 +123,13 @@ You can use any constant from the following list:
"wireless" // android
```

##Notes
## Notes
* Android plugin based on the following information: https://developer.android.com/reference/android/provider/Settings.html#ACTION_DREAM_SETTINGS
* iOS plugin based on the following information: https://gist.github.com/phynet/471089a51b8f940f0fb4
* In iOS, this plugin generates a URL scheme for the *-Info.plist configurations file.
* The plugin for Android is based on the forked repository and was refactored. The iOS part was built from skretch.

##License
## License
```
The MIT License
Expand Down
4 changes: 2 additions & 2 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?><plugin xmlns="http:https://www.phonegap.com/ns/plugins/1.0"
xmlns:android="http:https://schemas.android.com/apk/res/android"
id="com.phonegap.plugins.nativesettingsopener"
id="net.gsrweb.cordova.plugins.cordovaopennativesettings"
version="1.3.0">

<name>Native settings</name>
Expand All @@ -9,7 +9,7 @@

<engines>
<engine name="cordova" version=">=4.0.0" />
</engines>
</engines>

<js-module src="www/settings.js" name="Settings">
<clobbers target="cordova.plugins.settings" />
Expand Down

0 comments on commit fc6f5a5

Please sign in to comment.