使用 PhoneGap/jQuery Mobile 以编程方式在 iPhone/Android 日历中添加事件?
如何从 iOS/Android 中的 JavaScript / jQuery Mobile / PhoneGap 应用程序创建日历事件?
是否有任何插件,例如 PhoneGap 插件?在官方仓库中没有看到任何内容。
- 对于 iOS,Event Kit 框架 (iOS 4.0+) 似乎能够 添加事件。
How can I create a calendar event from a JavaScript / jQuery Mobile / PhoneGap app in iOS/Android?
Are there any, e.g., PhoneGap plugins? Didn't see any in the official repository.
- For iOS, the Event Kit framework (iOS 4.0+) seems to be able to add an event.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
根据下面的评论,现在可以为 iOS 创建 iCal 文件,为 Android 创建 vcs 文件。它将需要浏览器/设备嗅探,或者给用户选择,但它至少应该是可能的。
Per the comments below, it is now possible to create an iCal file for iOS and a vcs file for Android. It will require browser/device sniffing, or give the user the choice, but it should at least be possible.
我意识到这是一个老问题,但是有一个插件用于此现在。它有其缺点,但有效。在撰写本文时,它支持以下功能:
代码示例如下:
I realize it's old question but there is plugin for this now. It has its cons, but works. At the moment of writing it supports the following functionality:
Here follows code example:
目前,PhoneGap 开发路线图不包括日历支持。然而,有很多要求。请参阅这篇名为“遵循 W3C 日历 API 的日历插件”的帖子,其中指向 PhoneGap-Calendar-Plugin 项目,其中包括对 Android 的一些初始日历支持。
Currently the PhoneGap development roadmap does not include calendar support. However, there are many requests for it. See this post called "Calendar plugin following W3C calendar API" which points to the PhoneGap-Calendar-Plugin project which includes some initial calendar support for Android.
使用最新的 API,将事件添加到 iOS 日历非常简单。
但是,您需要创建自己的插件才能执行此操作。
由于这是特定于平台的,因此在官方 PhoneGap 插件出现之前,时间将会过去。
Adding an event to the iOS calendar is very simple with the latest API.
However, you need to create your own plugin in order to do it.
since this is platform specific, come time will pass before there is an official PhoneGap plugin.
我找到了适用于 Android 和 iOS 的插件,但它们没有相同的 JavaScript API,因此您必须为两个系统编写不同的代码或添加另一层。此外,它们也不是最新的,需要修复才能与 Cordova 2.2.0 一起运行。更糟糕的是,文档有点短:
Android
D Cheng 的 Android 插件 能够创建,删除并搜索日历事件,但已完全过时,并且无法按原样工作。 Android 4.0 中的 日历提供程序 可以让事情变得更简单但还是没有找到好的插件。 jbajor 只能添加事件,twistandshout 仅搜索事件。
iOS
Felixactv8 的 iOS 插件 能够创建、删除和搜索日历事件。请注意,在 iOS 中没有事件 ID,因此搜索事件会很有趣。 作者介绍了如何添加两者xcode 中需要的框架:
I found plugins for Android and iOS but they do not have the same JavaScript API so you have to write different code for both systems or add another layer. Also they are not up to date and will need fixes to run with Cordova 2.2.0. To make things worse documentation is kind of short:
Android
Dcheng's Android Plugin is able to create, remove and search calender events but is totally outdated and will not work as it is. With Android 4.0 there is a Calendar Provider that makes things easier but still I did not find a good plugin. jbajor can only add events and twistandshout only search events.
iOS
Felixactv8's iOS Plugin is able to create, remove and search calender events. Notice that in iOS there is no event id, so searching your events will be fun. The author explains how to add the two needed frameworks in xcode: