gpt4 book ai didi

android - 有没有办法使用 Intents 向新的日历事件添加提醒?

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:50:23 25 4
gpt4 key购买 nike

我需要支持 Android 2.1 及更高版本。我知道 CalendarContract 在 Android 2.1 中不可用,所以我做了以下解决方法。

Intent intent = new Intent(Intent.ACTION_EDIT)
.setType("vnd.android.cursor.item/event")
.putExtra("beginTime", beginTime.getTimeInMillis())
.putExtra("title", title)
.putExtra("description", description)
.putExtra("eventLocation", location)
.putExtra("allDay", allDay)
.putExtra(Intent.EXTRA_EMAIL, email );
if(!allDay) {
intent.putExtra("endTime", endTime.getTimeInMillis());
}

startActivity(intent);

到目前为止,这工作得很好。我已经在 2.1 到 4.1 上进行了测试。

我也想添加提醒,但我找不到任何关于如何使用 Intents 进行提醒的文档。有人有例子吗?我想避免向我的 list 添加更多权限以写入日历,因此如果您有需要该权限的建议,我将无法使用它。

最佳答案

如果你查看股票android日历源code , 无法使用 intent 添加提醒。

而不是这个日历有一个设置来设置默认提醒。但一些原始设备制造商可能已经实现了这一点。因此,即使您找到它,它也不会在所有手机上运行。

关于android - 有没有办法使用 Intents 向新的日历事件添加提醒?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13616470/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com