PhoneGap/Cordova calendar integration (Android)

风流意气都作罢 提交于 2019-12-03 17:28:36
Morrison Chang

The tutorial cited didn't cover intents. The intent you are sending your data to is your own CalendarPlugIn class which isn't what you want as it doesn't handle the intent.

See http://developer.android.com/guide/topics/intents/intents-filters.html regarding intents.

Also if you search around SO you'll find that until ICS there wasn't even a way to add things to the Google Calendar officially without using a web service. There are ways to do it unofficially, but are subject to the whims of Google or the ODMs themselves.

Updated:

You should be able to use intents with Phonegap (via a plugin). I only added the comment to note that if you intend to have calendar integration in your app, you'll probably have to do a bit of research if you want to support the majority of Android devices. If you are interested in adding calendar events in ICS look at: http://developer.android.com/reference/android/provider/CalendarContract.html

Op's Edit

I just needed to fix the Intent constructor, and this worked as expected:

Uri uri = Uri.parse("content://com.android.calendar/events");
Intent calIntent = new Intent("android.intent.action.INSERT", uri)

For making it work for all android sdk version try this following code

 Intent intent = new Intent(Intent.ACTION_EDIT);
 intent.setType("vnd.android.cursor.item/event");

I tried its working for me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!