Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: android jcalendar "putExtra" params


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 5 - Last Post: Jul 16, 2017 8:39 AM Last Post By: Darrel Christen...
Darrel Christen...

Posts: 25
Registered: 12/19/07
android jcalendar "putExtra" params  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 1, 2017 12:11 PM
Using Delphi 10 Berlin on a Windows 64-bit machine.

I'm creating a calendar entry on my tablet with the following code which is working fairly well...

{$IFDEF ANDROID}
var
   Intent   : JIntent;
   Calendar : JCalendar;
{$ENDIF ANDROID}
begin
   {$IFDEF ANDROID}
      Calendar := TJCalendar.JavaClass.getInstance;
 
      Intent := TJIntent.Create;
 
      Intent.setType(StringToJString('vnd.android.cursor.item/event'));
      intent.putExtra(StringToJString('beginTime'), Calendar.getTimeInMillis());
      intent.putExtra(StringToJString('allDay'), False);
                                                //DAILY, WEEKLY, MONTHLY, YEARLY
      intent.putExtra(StringToJString('rrule'), StringToJString('FREQ=DAILY'));
                                                                              { one day }
      intent.putExtra(StringToJString('endTime'), Calendar.getTimeInMillis()+ 172800000);
                                                                              { one hour }
      //intent.putExtra(StringToJString('endTime'), Calendar.getTimeInMillis()+ 3600000);
      intent.putExtra(StringToJString('title'), StringToJString('title text'));
                                                   { aka notes }
      intent.putExtra(StringToJString('description'), StringToJString('description text'));
      intent.putExtra(StringToJString('location'), StringToJString('location text'));
 
      SharedActivity.startActivity(Intent);
   {$ENDIF ANDROID}


... but on the event screen of the calendar app there IS a place for location but my location text doesn't seem to be getting through - is the name I need in the putExtra need to be something different that just "location"?

Also on the event screen of the calendar app is an option for Remind Me with entries such as "Never", "15 Minutes Before", "30 Minutes Before", etc. - does anyone know the the putExtra name for this and what the passed in option string(s) would be for the various choices?

Thanks in advance or any help.

drc :)

Francesco Marano

Posts: 59
Registered: 11/18/02
Re: android jcalendar "putExtra" params  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 1, 2017 2:12 PM   in response to: Darrel Christen... in response to: Darrel Christen...
Hello,

Maybe
intent.putExtra("eventLocation", myAddress)
source:
https://stackoverflow.com/questions/5352876/android-how-do-i-specify-a-location-when-calling-the-calendar-with-an-intent

Not tested.

Regards,
Francesco

Also, see this link for remainder (search for "hasAlarm"):
https://stackoverflow.com/questions/28659660/adding-event-with-reminders-to-calendar-with-intent-putextra-way-of-doing

Edited by: Francesco Marano on Jul 1, 2017 2:18 PM
Darrel Christen...

Posts: 25
Registered: 12/19/07
Re: android jcalendar "putExtra" params  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 2, 2017 7:14 AM   in response to: Francesco Marano in response to: Francesco Marano

Thanks! It's the long holiday weekend but I should have a window some to sneak in some coding time when no one is looking and at least try the location part.

drc :)
Darrel Christen...

Posts: 25
Registered: 12/19/07
Re: android jcalendar "putExtra" params  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 3, 2017 6:31 AM   in response to: Francesco Marano in response to: Francesco Marano

Follow up...

I tried "eventLocation" and that works!

However once I set "hasAlarm" what I really need is how to set the length of time before the event the alarm goes off. The calander app itself has a drop down with entries like "15 Minutes Before", "30 Minutes Beofre", etc. - I tried setting "minutes" and then "Minutes" (in case it's case sensitive) to 30 but the value of the drop down for a daily event just sits on the default of 15 minutes.

I can live with this and let the user select the time before the event the reminder is supposed to go off, but if anyone knows the putExtra parameter value that would allow me to set it that would be wonderful.

drc :)
Francesco Marano

Posts: 59
Registered: 11/18/02
Re: android jcalendar "putExtra" params  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 3, 2017 7:04 AM   in response to: Darrel Christen... in response to: Darrel Christen...
Hello,

Here
https://stackoverflow.com/questions/28659660/adding-event-with-reminders-to-calendar-with-intent-putextra-way-of-doing
the remainder is set like this:

not tested
LJCV : JContentValues;
begin
  LJCV := TJContentValues.Create();
  LJCV.put( JStringToString( 'minutes' ), 30 );
  LJCV.put( JStringToString( 'event_id' ), .. );
  LJCV.put( JStringToString( 'method' ), 1 {METHOD_ALERT} );
 
  TAndroidHelper.Context.getContentResolver().insert(
      TJCalendarContract_Reminders.JavaClass.CONTENT_URI,
      LJCV
      );


Regards,
Francesco
Darrel Christen...

Posts: 25
Registered: 12/19/07
Re: android jcalendar "putExtra" params  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 16, 2017 8:39 AM   in response to: Francesco Marano in response to: Francesco Marano

Sorry for the delay...

Thanks! I had to move on to some other code but will save this till I can come back to it.

drc :)

Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02