Skip to content
Permalink
Browse files
android: Use correct plugin name for navigator.app exec() calls
  • Loading branch information
agrieve committed Jan 18, 2015
1 parent a6245af commit 9c9610f2f115c266585ad34fd453e138b371f2af
Showing 1 changed file with 9 additions and 8 deletions.
@@ -20,13 +20,14 @@
*/

var exec = require('cordova/exec');
var APP_PLUGIN_NAME = Number(require('cordova').platformVersion.split('.')[0]) >= 4 ? 'CoreAndroid' : 'App';

module.exports = {
/**
* Clear the resource cache.
*/
clearCache:function() {
exec(null, null, "App", "clearCache", []);
exec(null, null, APP_PLUGIN_NAME, "clearCache", []);
},

/**
@@ -44,30 +45,30 @@ module.exports = {
* navigator.app.loadUrl("http://server/myapp/index.html", {wait:2000, loadingDialog:"Wait,Loading App", loadUrlTimeoutValue: 60000});
*/
loadUrl:function(url, props) {
exec(null, null, "App", "loadUrl", [url, props]);
exec(null, null, APP_PLUGIN_NAME, "loadUrl", [url, props]);
},

/**
* Cancel loadUrl that is waiting to be loaded.
*/
cancelLoadUrl:function() {
exec(null, null, "App", "cancelLoadUrl", []);
exec(null, null, APP_PLUGIN_NAME, "cancelLoadUrl", []);
},

/**
* Clear web history in this web view.
* Instead of BACK button loading the previous web page, it will exit the app.
*/
clearHistory:function() {
exec(null, null, "App", "clearHistory", []);
exec(null, null, APP_PLUGIN_NAME, "clearHistory", []);
},

/**
* Go to previous page displayed.
* This is the same as pressing the backbutton on Android device.
*/
backHistory:function() {
exec(null, null, "App", "backHistory", []);
exec(null, null, APP_PLUGIN_NAME, "backHistory", []);
},

/**
@@ -80,7 +81,7 @@ module.exports = {
* @param override T=override, F=cancel override
*/
overrideBackbutton:function(override) {
exec(null, null, "App", "overrideBackbutton", [override]);
exec(null, null, APP_PLUGIN_NAME, "overrideBackbutton", [override]);
},

/**
@@ -95,13 +96,13 @@ module.exports = {
* @param override T=override, F=cancel override
*/
overrideButton:function(button, override) {
exec(null, null, "App", "overrideButton", [button, override]);
exec(null, null, APP_PLUGIN_NAME, "overrideButton", [button, override]);
},

/**
* Exit and terminate the application.
*/
exitApp:function() {
return exec(null, null, "App", "exitApp", []);
return exec(null, null, APP_PLUGIN_NAME, "exitApp", []);
}
};

0 comments on commit 9c9610f

Please sign in to comment.