Joseph Khella
Joseph Khella

Reputation: 715

Error in Assets folder while running Cordova Android App (plugin)

I'm developing a cordova android app and I'm getting an error while using a calendar plugin from github https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin

the error is:

enter image description here

.....................................

my html file for including JSs

<script type=="text/javascript" src="cordova.js"></script>
<script type=="text/javascript" src="cordova_plugins.js"></script>
<script type=="text/javascript" src="JS/Calendar.js"></script>
<script src="JS/fncs.js"></script>

my fncs.js file is:

var startDate = new Date(2014,8,24,0,0,0,0,0);
var endDate = new Date(2014,8,27,0,0,0,0,0);
var title = "My nice event";
var location = "Home";
var notes = "Some notes about this event.";
var success = function(message) { document.getElementById("developers").innerHTML = "success";};
var error = function(message) { document.getElementById("developers").innerHTML = "failed";};
window.plugins.calendar.createCalendar(calendarName,success,error);

and here's my file structure:

enter image description here

JS folder >>

enter image description here

any help would be greatly appreciated .. thanks !

Upvotes: 0

Views: 300

Answers (1)

eduyayo
eduyayo

Reputation: 2038

Cordova has not been initialised yet. So window.plugins is undefined and u´ve got a crash.

instead of plain old javascript, try to put your initialization code inside one of the initialization events such as deviceready: http://cordova.apache.org/docs/en/2.5.0/cordova_events_events.md.html#deviceready

That way you can be sure Cordova is up and running.

Upvotes: 1

Related Questions