0

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 !

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you !! it's finally working ! +1 and absolutely a right answer !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.