Reputation: 11
It is possible- in XDK to emulate this simple thing, starting with an XDK stub then inserting a body..
<!DOCTYPE html><!--HTML5 doctype-->
<html>
<head>
<title>Your New Application</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0" />
<style type="text/css">
/* Prevent copy paste for all elements except text fields */
* { -webkit-user-select:none; -webkit-tap-highlight-color:rgba(255, 255, 255, 0); }
input, textarea { -webkit-user-select:text; }
body { background-color:white; color:black }
</style>
<script src='intelxdk.js'></script>
<script type="text/javascript">
/* This code is used to run as soon as Intel activates */
var onDeviceReady=function(){
//hide splash screen
intel.xdk.device.hideSplashScreen();
};
document.addEventListener("intel.xdk.device.ready",onDeviceReady,false);
</script>
</head>
<body>
<canvas id="game" width=300 height=300></canvas>
<script type="text/javascript"> (function() {
var ctx, noise;
ctx = document.getElementById("game").getContext("2d");
ctx.fillStyle = "#000";
ctx.fillRect(0, 0, 300, 300);
noise = function() {
var color, x, y, _i, _results;
_results = [];
for (x = _i = 0; _i <= 20; x = ++_i) {
_results.push((function() {
var _j, _results1;
_results1 = [];
for (y = _j = 0; _j <= 20; y = ++_j) {
color = Math.floor(Math.random() * 360);
ctx.fillStyle = "hsl(" + color + ", 60%, 50%)";
_results1.push(ctx.fillRect(x * 15, y * 15, 14, 14));
}
return _results1;
})());
}
return _results;
};
alert(ctx.canvas.width.toString());
setInterval(noise, 100);
}).call(this);
</script>
</body>
</html
---Building also works fine but when deploying the .apk to an Android-11 device it's just blank.
Also: deploying XDK sample projects works OK
Upvotes: 0
Views: 622
Reputation: 1125
Canvas is not supported by the simple Android WebView before Android 4.4 (API 19).
You need to use "Crosswalk for Android". You can find it on the "build menu".
Upvotes: 1