当前位置: 动力学知识库 > 问答 > 编程问答 >

android - How to implement the PhoneGap Calendar Plugin

问题描述:

Here is the Link: https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin#phonegap-build

I am wrapping the application in android through PhoneGap Build, not locally. So I wanted to know if I only need to follow the "PhoneGap Build" section under the Installation guidelines? Or do I need to add additional steps. As of right now I added <gap:plugin name="nl.x-services.plugins.calendar" /> to the config.xml file. And I added

<!-- below <script src="phonegap.js"></script> -->

<script src="js/plugins/Calendar.js"></script>

to the index.html file

Then created this function:

function save() {

var startDate = new Date("September 24, 2014 13:00:00");

var endDate = new Date("September 24, 2014 14:30:00");

var title = "My nice event";

var location = "Home";

var notes = "Some notes about this event.";

var success = function(message) { alert("Success: " + JSON.stringify(message)); };

var error = function(message) { alert("Error: " + message); };

// create (the only function also supported on Android for now)

window.plugins.calendar.createEvent(title,location,notes,startDate,endDate,success,error);

};

along with a button to call the above function onClick.

I feel like I am completely missing something, so if my errors come off as obviously please remember I am new to plugins and wrapping with PhoneGap. The PhoneGap build is 3.1 if you need to know. Thanks for any help!

Edit: Config.xml

<?xml version="1.0" encoding="UTF-8"?>

<widget xmlns = "http://www.w3.org/ns/widgets"

xmlns:gap = "http://phonegap.com/ns/1.0"

id = "com.mobile.Build"

versionCode=""

version = "1.0">

<name>Build</name>

<description>

</description>

<author href="www.removed.net" email="[email protected]">

SMD

</author>

<preference name="phonegap-version" value="3.1.0" />

<preference name="orientation" value="default" />

<preference name="fullscreen" value="false" />

<preference name="target-device" value="universal" />

<preference name="webviewbounce" value="true" />

<preference name="prerendered-icon" value="true" />

<preference name="stay-in-webview" value="true" />

<preference name="ios-statusbarstyle" value="default" />

<preference name="detect-data-types" value="true" />

<preference name="exit-on-suspend" value="false" />

<preference name="show-splash-screen-spinner" value="true" />

<preference name="auto-hide-splash-screen" value="true" />

<preference name="EnableViewportScale" value="true" />

<preference name="MediaPlaybackRequiresUserAction" value="false" />

<preference name="AllowInlineMediaPlayback" value="false" />

<preference name="BackupWebStorage" value="cloud" />

<preference name="TopActivityIndicator" value="gray" />

<preference name="KeyboardDisplayRequiresUserAction" value="false" />

<preference name="HideKeyboardFormAccessoryBar" value="false" />

<preference name="SuppressesIncrementalRendering" value="false" />

<preference name="android-minSdkVersion" value="8" />

<preference name="android-installLocation" value="auto" />

<preference name="SplashScreenDelay" value="1000" />

<preference name="ErrorUrl" value=""/>

<preference name="BackgroundColor" value="0x000000"/>

<preference name="KeepRunning" value="true"/>

<preference name="DisallowOverscroll" value="false"/>

<preference name="LoadingDialog" value=","/>

<preference name="LoadUrlTimeoutValue" value="20000" />

<preference name="disable-cursor" value="false" />

<gap:platform name="android" />

<gap:plugin name="org.apache.cordova.geolocation" />

<gap:plugin name="org.apache.cordova.inappbrowser" />

<gap:plugin name="org.apache.cordova.splashscreen" />

<gap:plugin name="nl.x-services.plugins.calendar" />

<access origin="*"/>

</widget>

分享给朋友:
您可能感兴趣的文章:
随机阅读: