cd C:\Kapsel_Projects\KapselGSDemo
cordova plugin add kapsel-plugin-appupdate --searchpath %KAPSEL_HOME%/plugins
cordova plugin add kapsel-plugin-logger --searchpath %KAPSEL_HOME%/plugins
or on a Mac
cd ~/Documents/Kapsel_Projects/KapselGSDemo
cordova plugin add kapsel-plugin-appupdate --searchpath $KAPSEL_HOME/plugins
cordova plugin add kapsel-plugin-logger --searchpath $KAPSEL_HOME/plugins
<html>
<head>
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<script type="text/javascript" charset="utf-8" src="datajs-1.1.2.min.js"></script>
<script type="text/javascript" charset="utf-8" src="serverContext.js"></script>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<style type="text/css">
body {
background-color: yellow;
}
</style>
<script>
window.onerror = onError;
function onError(msg, url, line) {
if (!url) {
console.log("An unknown error occurred");
return false;
}
var idx = url.lastIndexOf("/");
var file = "unknown";
if (idx > -1) {
file = url.substring(idx + 1);
}
alert("An error occurred in " + file + " (at line # " + line + "): " + msg);
var r = confirm("Check to see if an update is available?");
if (r == true) {
sap.Logon.init(function() { }, function() { alert("Logon Failed"); }, appId);
sap.AppUpdate.update();
}
return false; //suppressErrorAlert;
};
function init() {
if (sap.Logger) {
sap.Logger.setLogLevel(sap.Logger.DEBUG); //enables the display of debug log messages from the Kapsel plugins.
sap.Logger.debug("Log level set to DEBUG");
}
sap.AppUpdate.addEventListener("checking", function(e) {
console.log("Checking for update");
});
sap.AppUpdate.addEventListener("noupdate", function(e) {
console.log("No update");
});
sap.AppUpdate.addEventListener("downloading", function(e) {
console.log("Downloading update");
});
//SP02 New Feature
sap.AppUpdate.addEventListener("progress", function(e) {
if (e.lengthComputable) {
var percent = Math.round(e.loaded / e.total * 100);
//console.log("Progress " + percent);
document.getElementById('statusLabel').innerHTML = "Download progress " + percent + "%";
}
});
sap.AppUpdate.addEventListener("error", function(e) {
console.log("Error downloading update. statusCode: " + e.statusCode + " statusMessage: " + e.statusMessage);
});
/* //Notice that addEventListener adds the function to the chain of functions that are notified.
sap.AppUpdate.addEventListener("updateready", function(e) {
console.log("Update ready");
});
*/
//Notice here that we are overriding the default handler for the updateready event
sap.AppUpdate.onupdateready = function() {
console.log("Confirming application update");
document.getElementById('statusLabel').innerHTML = "";
navigator.notification.confirm("New update available",
function(buttonIndex) {
if (buttonIndex === 2) {
console.log("Applying application update");
sap.AppUpdate.reloadApp();
}
},
"Update", ["Later", "Relaunch Now"]);
};
sap.Logon.init(function() { }, function() { alert("Logon Failed"); }, appId, context);
}
document.addEventListener("deviceready", init, false);
</script>
</head>
<body>
<h1>AppUpdate Sample</h1>
<label id="statusLabel"></label>
</body>
</html>
<preference name="hybridapprevision" value="0" />
<preference name="sap-development-version" value="1.2.3" />
cordova run android
or
cordova run ios
C:\SAP\MobileSDK3\KapselSDK\cli
~/SAP/MobileSDK3/KapselSDK/cli
npm install -g
sudo npm -g install
kapsel package
kapsel deploy com.kapsel.gs localhost:8083 smpAdmin s3pAdmin
Failed to fetch CSRF token
1%ERROR: Error: tunneling socket could not be established, cause=Parse Error
<Location >
AddOutputFilterByType SUBSTITUTE application/json
Substitute "s|smpqa-win12-03.sybase.com:8080|smpqa12-03.sybase.com|ni"
</Location>
<style type="text/css">
body {
background-color: silver;
}
</style>
cordova prepare
kapsel package
kapsel deploy com.kapsel.gs localhost:8083 smpAdmin s3pAdmin
// Override default handler
sap.AppUpdate.onupdateready = function(e) {
// No notification just reload
console.log("Apply update");
sap.AppUpdate.reloadApp();
}
cordova prepare
kapsel package
kapsel upload com.kapsel.gs localhost:8083 smpAdmin s3pAdmin
kapsel status com.kapsel.gs localhost:8083 smpAdmin s3pAdmin
kapsel stage com.kapsel.gs android -1 localhost:8083 smpAdmin s3pAdmin
/Users/user_name/Library/Developer/CoreSimulator/Devices/602C969F-F0CD-4043-AFBF-583C62F5A8BA/data/Containers/Data/Application/97CE6DBB-50F1-451E-A503-B5E79F4C7302/Documents/SMP/appupdate/app/www
data\data\com.kapsel.gs\files\download\www
<html>
<head>
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<script src="cordova.js"></script>
<script type="text/javascript" charset="utf-8" src="serverContext.js"></script>
<style type="text/css">
body {
background-color: silver;
}
</style>
<script>
window.onerror = onError;
//callNonExistantMethod(); //Introduce an error that can be recovered by deploying a new version to the SMP 3.0 server
//window.location.replace("doesNotExist.html"); //Introduce an error that can only be recovered on Android by the errorUrl config parameter. Requires the app to be force closed before it can be opened again after receiving the download
function onError(msg, url, line) {
if (!url) {
console.log("An unknown error occurred");
return false;
}
var idx = url.lastIndexOf("/");
var file = "unknown";
if (idx > -1) {
file = url.substring(idx + 1);
}
alert("An error occurred in " + file + " (at line # " + line + "): " + msg);
window.location.replace("error.html");
//var ref = window.open("./error.html", "_blank", "location=no");
return false; //suppressErrorAlert;
};
function init() {
if (sap.Logger) {
sap.Logger.setLogLevel(sap.Logger.DEBUG); //enables the display of debug log messages from the Kapsel plugins.
sap.Logger.debug("Log level set to DEBUG");
}
sap.Logon.init(function() { }, function() { alert("Logon Failed"); }, appId, context);
}
document.addEventListener("deviceready", init, false);
</script>
</head>
<body>
<h1>AppUpdate Sample</h1>
</body>
</html>
<html>
<head>
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript" charset="utf-8" src="serverContext.js"></script>
<style type="text/css">
body {
background-color: goldenrod;
}
</style>
</head>
<body>
<h1>AppUpdate Sample</h1>
If you are here something bad happened. Sorry about that!
<p>
If this is the first time you are seeing this, please call the help desk: <a href="tel:8005551212">(800)555-1212</a>
<p>
The problem may have already been fixed. Click the update button to see if there is a fix.
<input id="updateCheck" type="button" value="Check For Update" onclick="checkForError()" />
<p>
<p>
<label id="statusLabel"></label>
</body>
<script>
logonView = null;
logon = null;
applicationContext = null;
function checkForError() {
var appId = "com.kapsel.gs"; // Change this to app id on server
sap.AppUpdate.onchecking = function() {
console.log("AppUpdate_checking");
};
sap.AppUpdate.ondownloading = function() {
console.log("AppUpdate_downloading");
}
sap.AppUpdate.onnoupdate = function() {
console.log("AppUpdate_noupdate");
}
sap.AppUpdate.onupdateready = function() {
//No notification just reload
console.log("AppUpdate_onupdateready");
sap.AppUpdate.reloadApp(); // Go back to the application
window.location.replace("index.html");
};
sap.AppUpdate.onerror = function() {
console.log("AppUpdate_error");
}
sap.Logon.init(function() {sap.AppUpdate.update()}, function() { alert("Logon Failed"); }, appId, context);
}
</script>
</html>
cordova prepare && kapsel package
kapsel deploy com.kapsel.gs localhost:8083 smpAdmin s3pAdmin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
26 | |
24 | |
21 | |
13 | |
9 | |
9 | |
9 | |
9 | |
8 | |
8 |