Skip to content

placefull/cordova-open-native-settings

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#NativeSettings plugin for Android and iOS 8 Cordova.

The plugin allows you to open Settings view from Android Cordova application and to open Native App settings view from iOS 8 Cordova application. Based on https://github.com/raulduran/VideoPlayer.

##Adding the Plugin to your project

cordova plugin add https://github.com/selahssea/Cordova-open-native-settings.git

##Removing the Plugin to your project

cordova plugin rm com.phonegap.plugins.nativesettingsopener

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

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

###Example for iOS and Android

if(typeof cordova.plugins.settings.openSetting != undefined){
    cordova.plugins.settings.open(function(){
            console.log("opened settings")
        },
        function(){
            console.log("failed to open settings")
        });
}

###Example for iOS

// function definition
NativeSettings.prototype.openBluetoothSettings = function (onsucess, onfail) {
    exec(onsucess, onfail, "NativeSettings", "openBluetoothSettings", []);
};

// open quietly and fail quietly
cordova.plugins.settings.openBluetoothSettings(null, null);

// with callbacks
cordova.plugins.settings.openBluetoothSettings(
  function() {
    console.log("SUCCESS: Opened iOS bluetooth settings");
    // insert success callback
  },
  function() {
    console.log("ERROR: Failed to open iOS bluetooth settings");
    // insert fail callback
  });
};

##Android Settings

Select one of the options below for the param settingName

    "open",
    "accessibility",
    "add_account",
    "airplane_mode",
    "apn",
    "application_details",
    "application_development",
    "application",
    "bluetooth",
    "captioning",
    "cast",
    "data_roaming",
    "date",
    "device_info",
    "display",
    "dream",
    "home",
    "input_method",
    "input_method_subtype",
    "internal_storage",
    "locale",
    "location_source",
    "manage_all_applications",
    "manage_applications",
    "memory_card",
    "network_operator",
    "nfcsharing",
    "nfc_payment",
    "nfc_settings",
    "print",
    "privacy",
    "quick_launch",
    "search",
    "security",
    "settings",
    "show_regulatory_info",
    "sound",
    "sync",
    "usage_access",
    "user_dictionary",
    "voice_input",
    "wifi_ip",
    "wifi",
    "wireless"

##Using the plugin for Android

cordova.plugins.settings.openSetting(settingName, success_callback, failure_callback);

###Example for Android

if(typeof cordova.plugins.settings.openSetting != undefined){
    cordova.plugins.settings.openSetting("nfc_settings", function(){
            console.log("opened nfc settings")
        },
        function(){
            console.log("failed to open nfc settings")
        });
}

About

Plugin for cordova that open native settings view.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 85.2%
  • Objective-C 9.5%
  • JavaScript 5.3%