We are building a fairly simple app for android, iOS and windows phone and we decided to go with Titanium.
As it turned out, Windows Phone support seems to be pretty bad at this moment. Because we needed a fully functional map on all three platforms so we went with integrating WebView/leaflet
map. Communication is done through documentation suggested Ti.App.fireEvent
and Ti.App.addEventListener
which are working with no problems on iOS and android, but we have a problem with windows phone which is not registering any events or sending any events between app and webpage loaded in WebView.
What could we miss that we face this problem?
(used SDK is most recent so 5.1.2, windows 8.1)
Can you use the sample code below
"logging.html"
<html>
<head>
<script>
Ti.App.addEventListener("app:fromTitanium", function(e) {
alert(e.message);
});
</script>
</head>
<body>
<button onclick="Ti.App.fireEvent('app:fromWebView', { message: 'event fired from WebView, handled in Titanium' });">fromWebView</button>
</body>
</html>
"app.js"
var win = Ti.UI.createWindow();
var webview = Ti.UI.createWebView({
url: 'logging.html'
});
var button = Ti.UI.createButton({
title: 'fromTitanium',
height: '50dp',
width: '130dp'
});
button.addEventListener('click', function(e) {
Ti.App.fireEvent('app:fromTitanium', { message: 'event fired from Titanium, handled in WebView' });
});
Ti.App.addEventListener('app:fromWebView', function(e) {
alert(e.message);
});
win.add(webview);
win.add(button);
win.open();
Create a file name "logging.html" in your project and put the html code in there. and put the code to "app.js".
If the error still persist, Please check if this is a known issue at the https://jira.appcelerator.org/. If it's not, create a ticket, link to this question but also provide reproducible code, steps and environment information in the ticket itself. Don't forget to drop a link to the ticket here so that others can watch it with you.