javascriptdom-eventstitaniumappceleratortitanium-mobile

Why won't Appcelerator detect an event Fired?


In my HTML file, I have:

<html><head> 
<style>html{width: 320px; } body {padding: 0; margin: 0 auto; width: 320px;} img {left: 0; top: 0; display: block;}</style>

<script>
  Titanium.App.fireEvent('someEvent', {});
</script>
</head><body>
<a href="http://www.google.com" target="_blank">LINK!!!</a>
</body></html>

And in app.js, I have:

Ti.App.addEventListener('someEvent', function(e){
 alert("RECEIVED");

Yet, when I load the webview with index.html, my app crashes. Any idea why this is?


Solution

  • if your using the android emulator 2.3... there is a known bug that you can't use any of the Titanium functions inside a webview. Something to do with google refusing to fix an issue that affects what appcelerator are trying to do. Its recommended you try this section on your device instead.

    it should work fine in 2.2 emulator and I think everything above 3

    Is this your issue?