如何实现PhoneGap日历插件

时间:2014-02-13 22:34:41

标签: android jquery cordova

以下是链接:https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin#phonegap-build

我通过PhoneGap Build将应用程序包装在android中,而不是本地。所以我想知道我是否只需要按照安装指南中的“PhoneGap Build”部分进行操作?或者我是否需要添加其他步骤。截至目前,我已将<gap:plugin name="nl.x-services.plugins.calendar" />添加到config.xml文件中。我添加了

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

到index.html文件

然后创建了这个函数:

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);

};

以及一个用于调用上述函数onClick的按钮。

我觉得我完全错过了一些东西,所以如果我的错误明显失败,请记住我是新手插件和包装PhoneGap。如果你需要知道,PhoneGap版本是3.1。谢谢你的帮助!

编辑: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="editor@removed">
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>

0 个答案:

没有答案