0

I recently upgraded a project from Cordova 2.2 to 3.5, and can't get any of the plugins to work. I have followed all the instructions for using the CLI to build the project and add plugins (as described here), and have checked that the config files and cordova_plugins.js are correct (as explained here). My required plugs are the media (audio) and Power plugins (the latter to delay powerdown) - neither appeared to be working so I also added a 'simpler to test' Device plugin to see if I could read the device type. That doesn't work either so it appears all my plugins are failing. I am calling the code as follows:

    var beep = new Media("/android_asset/www/res/beep_mp3.mp3");
    beep.play();

and

    chrome.power.requestKeepAwake("display");

Testing on Android 4.4.2

Community
  • 1
  • 1
quilkin
  • 874
  • 11
  • 31
  • You say not working, but not how exactly it's not working. Are you having errors in the logs? You say you followed all instructions, but as it's not working, we can imagine you missed something, but if you don't detail the steps you're following to create your project, add the plugins, build the project and don't provide any source of how you're trying to call the plugin, it's quite unlikely you're going to have many answers. – QuickFix Jul 28 '14 at 17:18
  • The project is being created, built and run as per Cordova instructions at [link](http://cordova.apache.org/docs/en/3.5.0/guide_cli_index.md.html#The%20Command-Line%20Interface). – quilkin Jul 28 '14 at 17:35
  • OK, thanks, more details added now. – quilkin Jul 28 '14 at 17:48
  • 1
    Sorry to bother again, but linking to the docs doesn't detail what you actually did. Have you checked for errors in the logcat console? Anyway, one thing I can recommend you is create a new project and follow the steps again, like this you'll know if something gets corrupted in your project. – QuickFix Jul 29 '14 at 10:38
  • Solved now, see below – quilkin Aug 01 '14 at 14:51

1 Answers1

0

Thank you, quickfix, for your perseverance. Problem now solved. I did create a new project and the plugins started to work. Then started to find out why they wouldn't in my main project. In the end I found it was because the location of cordova.js was incorrect. Cordova resources couldn't be found. In the older project (using cordova 2.2) I had, in 'index.html'

<script src="js\cordova.js"></script> 

which was working, so I hadn't changed it. With Cordova 3 the correct line, making use of where the CLI automatically arranges files, is

<script src="cordova.js"></script> 

BTW I found the problem using the Chrome debugger , I had all sorts of problems using Eclipse. So I think I'll continue using just the CLI and the Chrome debugger, and avoid Eclipse

quilkin
  • 874
  • 11
  • 31