Question

I have newest Ripple Emulator installed (newest available in Chrome Store) and everything works just fine, except events. None of them fires (not only deviceready as in some other Stack Overflow question, none).

Neither manually (using Events pane) nor automatically (deviceready) fired.

When I use manual method, Ripple writes a line to the console, that it is firing an event, but nothing actually happens. My application does not react at all. I have backbutton event bind and it is not working in Ripple. And application stopped working at all, when I moved its init part to deviceready event, as it is not being fired. Of course, on target device everything is fine, so code should be correct.

What can be causing such behavior and is there any workaround for it?

EDIT: I have Ripple Emulator (Beta) 0.9.15 installed as Chrome Extension on Windows 7. All is just fine on destination device, so JS code (events handlers) should be fine.

Was it helpful?

Solution

After deeper investigation I've managed to solve this problem (at least partially -- some events are fired some are not). In my case it was a missing .js (PhoneGap source) file problem.

The key to the success was to:

  1. Actually have PhoneGap / Cordova JS file placed in your app content and have it correctly referenced (valid path and file name) in your source files.

  2. Have source file in correct version (2.0.0) as of writing this.

First can be especially confusing for PhoneGap Build users, which are instructed to remove source file. Reference in source file (<script type="text/javascript" src="cordova.js"></script>) should be untouched, but file, it references, should not exits. PhoneGap Build will inject this file (in proper version) during compile / build process.

This is fine for PhoneGap, but completely wrong for Ripple. If you want Ripple to be fully functional and be able to fire events (at least certain), you should leave that file in place. I found out, that this does not interfere PhoneGap at all. Apps are builded without problems, with and without that file in place.

Second is also important. I found out, that current version of Ripple is build basing on PhoneGap API 2.0.0, which is very, very old against currently available PhoneGap API 3.0.0. So, to have Ripple working nearly without glitches, you have to [browse PhoneGap repository(http://phonegap.com/install/) and grab PhoneGap 2.0.0 sources, released 20 Jul 2012 and extract cordova.js files out of it. Then place it in source folder of your webapp, add correct reference to it and try Ripple then.

At least some events should now be fired (some, like deviceready) may still fail.

Also, keep in mind, that everything, including event handlers, must be defined in a deviceready event listener code, or the whole thing will fail.

Ripple's JIRA issues, that might be related:

BTW: if you open up browser's console and manually fire an event you'll see a proper notice written to console by Ripple. Which means, that Ripple thinks, if fires an even on an emulated webapp, but it actually doesn't fire it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top