user3262344
user3262344

Reputation: 125

debugging phonegap apps on pc for phonegap build

i am creating phonegap apps via phonegap build..i am able to check for "normal" events and variables in the web inspector tools. but the browser doesnt understand phonegap events

for example:

  document.addEventListener('deviceready', this.onDeviceReady, false);

this code throws an error as there is no 'deviceready' event.

How can i check for native phonegap events and methods on PC.

Note: i am using phoneGap Build and not the CLI

Upvotes: 0

Views: 127

Answers (1)

balzafin
balzafin

Reputation: 1426

You can't run an PhoneGap App in your browser. Luckily you have few options.

  1. Use an emulator such as Android Emulator. This way you can use logcat to log your debug messages. The down side is that some features (e.g. push notifications) won't work in an emulator without setting up helpers.
  2. Use Remote Debugging with Chrome. This is my personal favorite, since you can use Chrome Developer Tools (including console) just as if you would if you were running your page in a browser. The down side is that you will always have to build your app and update it to your device. You can do this with hydration of course.
  3. Use Weinre. I can't recommend it, because I feel it's unreliable, slow and does not log errors. But you may wan't to try it out. It's easy because you don't have to do any configuration.

Here's a list of some other debugging options you may consider: https://github.com/phonegap/phonegap/wiki/Debugging-in-PhoneGap. Notice that Ripple works only when using PhoneGap 2.x (and should not use it). Hope this helps.

Upvotes: 2

Related Questions