Activity Starter to capture an event to phone calendar

Hi all,

Please can someone point me in the direction of an activity starter code that can save an event to the phone calendar. If it’s possible

I found this

but I’m unsure on the implimentation

val intent = Intent(Intent.ACTION_INSERT)
.setData(CalendarContract.Events.CONTENT_URI)
.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, startMillis)
.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, endMillis)
.putExtra(CalendarContract.Events.TITLE, “Yoga”)
.putExtra(CalendarContract.Events.DESCRIPTION, “Group class”)
.putExtra(CalendarContract.Events.EVENT_LOCATION, “The gym”)
.putExtra(CalendarContract.Events.AVAILABILITY, CalendarContract.Events.AVAILABILITY_BUSY)
.putExtra(Intent.EXTRA_EMAIL, “[email protected],[email protected]”)
startActivity(intent)

Thanks

t

Maybe this might help

Hi Dora

Im not sure Google calendar will do what I need it to do.

What I need is to save an appointment to the user phone.

Seems to me that google calendar will save it to MY calendar???

Thanks, I going to give it a bash.

was the “X” in front you or was this an extension??

t

An extension

https://groups.google.com/g/mitappinventortest/c/IM9yDZDAm-Q/m/IcxUtvX2BQAJ

1 Like

blocks - 2021-08-23T224107.321

blocks - 2021-08-23T224116.418

It works, sort of…

It calls the Calendar but it gives me a date of 1 Jan 2100???

Any idea why?

Also any idea how I can access the full range of things like

email

Alarm before

Repeats

Notes

Invites

t

Because you have did mistake in the procedure. Actually date stores in a caribe first , not in a label. But you ate trying to store the date displaying in the label to tinydb before it appears in the label so tinydb stores empty string. So use the same variable in tinydb as well as in label

I hope you can see the list of gmail used in the phone using taifun account manager extension

blocks - 2021-08-24T072945.519

Thanks but Im using two different formats

One for a Label and one for a variable

The label has Appontment Date added the variable is just the date

blocks - 2021-08-24T073331.608

So, I dont think thats the problem, bu thanks anyway

In your sample image we didnt see so i suggested… well, in such case what you have to do mean, replace block you have to use. because after picking the date in your lbl date text you are adding App date., so it may(of course, it is) created the problem. anyway you can use either method…

The value stored in the TinyDB I use here…

The values stored in the global variable I use here

blocks - 2021-08-24T073331.608

No, I think the problem is in the Activity Starter block

This is the problem

block102

not even this…
block103

despiote removing “[” and “]” and “,”

For me it works fine

1 Like

Topic closed at OP’s request

1 Like