Bug 23111 - New calendar event created via an Intent ignores the dates parameters
Summary: New calendar event created via an Intent ignores the dates parameters
Status: RESOLVED NORESPONSE
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 4.18.0
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2014-09-17 16:15 UTC by Valentin Polushkin
Modified: 2017-07-05 17:40 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NORESPONSE

Comment 1 Arpit Jha 2014-10-07 08:22:57 UTC
I have checked this issue and unable to reproduce it.

I tried following steps to reproduce it.
1.Create a Xamarin Android Application.
2.Did some code in Main Activity.cs
using System;

using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;

using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.Provider;
using Java.Util;

namespace androidtestbr
{
	[Activity (Label = "androidtestbr", MainLauncher = true, Icon = "@drawable/icon")]
	public class MainActivity : Activity
	{
		int count = 1;

		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Set our view from the "main" layout resource
			SetContentView (Resource.Layout.Main);

			// Get our button from the layout resource,
			// and attach an event to it
			Button button = FindViewById<Button> (Resource.Id.myButton);
			
			button.Click += delegate {


				//button.Text = string.Format ("{0} clicks!", count++);
				Intent calendarIntent =
					new Intent(Intent.ActionInsert)
						.SetData(Android.Provider.CalendarContract.Events.ContentUri)
						.PutExtra(CalendarContract.Events.InterfaceConsts.Dtstart,
							GetMillisecondsSinceUnixEpoch(2014, 9, 15, 8, 30))
						.PutExtra(CalendarContract.Events.InterfaceConsts.Dtend,
							GetMillisecondsSinceUnixEpoch(2014, 9, 15, 9, 30))
						.PutExtra(CalendarContract.Events.InterfaceConsts.Title, "foo");

						StartActivity(calendarIntent);
			};
		}



		long GetMillisecondsSinceUnixEpoch(int year, int month, int day, int hour, int
			minute)
		{
			DateTime UnixEpoch = new DateTime (1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

			DateTime local = new DateTime(year, month, day, hour, minute, 0,
				DateTimeKind.Local);
			DateTime utc = local.ToUniversalTime();

			return (long) (utc - UnixEpoch).TotalMilliseconds;
		}

	}
}


3.Run the application.
4.Click on Button "Hello World, Click Me!"
I observed that both able to create event but Default Dstart and Dend is Selected today date.

Let me know if I missed anything to reproduce it.
Screencast regarding Same :
http://www.screencast.com/t/chhWZlF9
Add Event Screen output :
http://www.screencast.com/t/5SVr2zF0H

Application Output :
https://gist.github.com/AkhileshKumar01/e91295396597f16c9b95
Environment Info:=== Xamarin Studio ===

Version 5.5 (build 227)
Installation UUID: 3dbf10c4-ed30-4e55-8a8b-1704777c7b5f
Runtime:
	Mono 3.10.0 ((detached/633e444)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000020

=== Xamarin.Android ===

Version: 4.18.0 (Indie Edition)
Android SDK: /Users/apprpject/Desktop/android-sdk-macosx
	Supported Android versions:
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.1    (API level 12)
		3.2    (API level 13)
		4.0    (API level 14)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		4.5    (API level 21)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Apple Developer Tools ===

Xcode 5.1 (5084)
Build 5B130a

=== Xamarin.iOS ===

Version: 8.2.0.193 (Indie Edition)
Hash: 959c1e4
Branch: 
Build date: 2014-10-03 00:25:37-0400

=== Xamarin.Mac ===

Version: 1.10.0.18 (Indie Edition)

=== Build Information ===

Release ID: 505000227
Git revision: 7b721eeec7a2fa4c4f4de0ecd2aed4dc25edac95
Build date: 2014-10-02 15:53:38-04
Xamarin addins: 99ed56b428b31eba1efaace4d82188d6f334e6ca

=== Operating System ===

Mac OS X 10.8.5
Darwin localhost 12.5.0 Darwin Kernel Version 12.5.0
    Sun Sep 29 13:33:47 PDT 2013
    root:xnu-2050.48.12~1/RELEASE_X86_64 x86_64
Comment 3 Arpit Jha 2014-10-07 10:29:54 UTC
As per Comment 1 & 2, I am confirming this issue.
Comment 4 Jonathan Pryor 2014-10-07 11:04:08 UTC
@Arpit: Please update your project so that it conforms to documentation:

http://developer.android.com/reference/android/provider/CalendarContract.Events.html

> When inserting a new event the following fields must be included:
> * dtstart
> * dtend if the event is non-recurring
> * duration if the event is recurring
> * rrule or rdate if the event is recurring
> * eventTimezone
> * a calendar_id

From Comment #1 I see dtstart and dtend, but I do NOT see eventTimezone, nor a calendar_id.
Comment 5 Ram Chandra 2014-10-07 14:50:03 UTC
@JonP : Thanks,  I have updated the project as mentioned in comment 4 and observed that the value of default Dstart and Dend is still showing the today's date.

Code :

int _calId = Intent.GetIntExtra ("calId", -1);

            button.Click += delegate {
                //button.Text = string.Format ("{0} clicks!", count++);
                Intent calendarIntent = new Intent(Intent.ActionInsert)
                    .PutExtra(CalendarContract.Events.InterfaceConsts.CalendarId, _calId)
                    .SetData(Android.Provider.CalendarContract.Events.ContentUri)
                    .PutExtra(CalendarContract.Events.InterfaceConsts.Dtstart, GetMillisecondsSinceUnixEpoch(2014, 9, 15, 8, 30))
                    .PutExtra(CalendarContract.Events.InterfaceConsts.Dtend,GetMillisecondsSinceUnixEpoch(2014, 9, 15, 9, 30))
                    .PutExtra(CalendarContract.Events.InterfaceConsts.EventTimezone, "Local")
                    .PutExtra(CalendarContract.Events.InterfaceConsts.Title, "foo");
                StartActivity(calendarIntent);
               
            };

Application output: https://gist.github.com/saurabh360/6b3fb9d83828bb2dc2d7
Device logs: https://gist.github.com/saurabh360/56c55f74e7b035ff6255

Please let me know if I am missing something?

Environment Info:

=== Xamarin Studio ===

Version 5.5 (build 227)
Installation UUID: 6ea47b0d-1852-4aaf-808d-373ff0a5002b
Runtime:
	Mono 3.10.0 ((detached/633e444)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 310000020

=== Apple Developer Tools ===

Xcode 6.0.1 (6528)
Build 6A317

=== Xamarin.Mac ===

Version: 1.10.0.18 (Business Edition)

=== Xamarin.Android ===

Version: 4.18.0 (Business Edition)
Android SDK: /Users/jatin66/Desktop/Backup/android-sdk-macosx
	Supported Android versions:
		1.6   (API level 4)
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.0   (API level 11)
		3.1   (API level 12)
		3.2   (API level 13)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.3   (API level 18)
		4.4   (API level 19)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin.iOS ===

Version: 8.2.0.196 (Business Edition)
Hash: c6bcfc8
Branch: 
Build date: 2014-10-05 21:42:57-0400

=== Build Information ===

Release ID: 505000227
Git revision: 7b721eeec7a2fa4c4f4de0ecd2aed4dc25edac95
Build date: 2014-10-02 15:53:38-04
Xamarin addins: 99ed56b428b31eba1efaace4d82188d6f334e6ca

=== Operating System ===

Mac OS X 10.9.5
Darwin Jatin66s-iMac.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
Comment 6 Chris Hardy [MSFT] 2017-07-05 17:40:32 UTC
Marking as resolved as Valentin is not with Xamarin anymore.