Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
I have been attempting to create a calendar event in Android that has a reminder programmatically set along with the title, date and time. Using the examples in the Calendar Demo I have been able to create the event, but when I include code to set a 15 minute reminder the event that is created is unstable.
There is no error returned from the app, but when I click the event in the Android Calendar, Calendar crashes.
I believe that the problem is going to be rooted in a reminder being set before the attending status is flagged, but I could be wrong. In an attempt to test this theory I have been searching for a way to pragmatically set the event status to Confirmed. I am unable to find example code or adequate documentation to assist me
"Documentation for this section has not yet been entered"
* "Documentation for this section has not yet been entered"
* [System.Obsolete("This constant will be removed in the future version. Use Android.Provider.EventsStatus enum directly instead of this field.")]
"Documentation for this section has not yet been entered"
Any assistance you can provide along this avenue would be greatly appreciated.
Here is the order of death for CalendarProblem:
· The first screen prompts you with a button to launch the CalendarList activity that allows the user to select which calendar the event will be added to.
· When that calendar is selected the ID is passed to the SetReminder activity where the user can change the time and date of the Event, then set the event with a 15 minute reminder or without a reminder.
· If you then open the Android Calendar program you should see two entries one titled “Calendar Problem – With Reminder” and “Calendar Problem – No Reminder.”
· Selecting the event marked No Reminder won’t cause any issues. If you select “Calendar Problem – With Reminder” the Android Calendar program will crash.
Created attachment 6434 [details]
I modified this test project from the one that the customer in desk case https://xamarin.desk.com/agent/case/66058 sent to remove a couple of unrelated errors he mentioned after sending the project. I also inserted a couple of console output lines to show the output from the relevant fields.
After investigation, I found that commenting out line 79 in SetReminder.cs resolved this issue.
RemindersMethod.Alert does not seem to return the correct value for passing to the CalendarContract. IN addition it seems that CalendarContract.Events.InterfaceConsts.AllowedReminders and CalendarContract.CalendarColumns.AllowedReminders do not return a comma separated list of allowed reminder types from the CalendarContract as the android docs suggest it should:
Changing line 79 to:
Also works. In the calendar app on my device (Samsung Galaxy 2), there is only one available reminder type, Alert, which has the enum value of 1. Using a value other than 1 for the second argument above results in no reminder added, however using 1 as the second argument results in an event added with an Alert reminder, same as commenting out the line, which one would assume sets the default reminder method.
According to the docs the available reminder method values are: Default(0), Alert(1), Email(2), SMS(3)
However depending on the calendar app on the device some may not be available, thus the need to be able to check the AllowedReminders for a calendar with CalendarContract.CalendarColumns.AllowedReminders or CalendarContract.Events.InterfaceConsts.AllowedReminders.
I have checked this issue with the help of attached calendar project. I debug application and followed steps mentioned in the bug description.
When I select “Calendar Problem – With Reminder” the Android Calendar program will crash.
Device Log: https://gist.github.com/saurabh360/8a7049b2e9bbf5553b18
=== Xamarin Studio ===
Version 4.2.3 (build 60)
Installation UUID: b1fc3b76-cf00-405e-a0a1-3839ac11fe6d
=== Apple Developer Tools ===
Xcode 5.1 (5084)
=== Xamarin.Android ===
Version: 4.12.1 (Enterprise Edition)
Android SDK: /Users/apple/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)
Java SDK: /usr
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
=== Build Information ===
Release ID: 402030060
Git revision: 30c4afc300c2a39ec5300851357ce02e49dd217e
Xamarin addins: f8a9589b57c2bfab2ccd73c880e7ad81e3ecf044
=== Operating System ===
Mac OS X 10.9.3
Darwin Apples-iMac.local 13.2.0 Darwin Kernel Version 13.2.0
Mon Mar 24 19:18:06 PDT 2014
Is this a port of any Java code? If so, can the original Java code be provided?
@Sadik, @Jon: What Android version is the target device running? I've tried this on my Nexus 5 w/ Android v4.4.2, and it doesn't trigger the error listed in Comment #5.
I thus have to wonder if this depends on the Android target's version.
Furthermore, the stack trace in Comment #5:
> E/AndroidRuntime(26753): java.lang.NumberFormatException: Invalid int: "Alert"
> E/AndroidRuntime(26753): at java.lang.Integer.invalidInt(Integer.java:138)
> E/AndroidRuntime(26753): at java.lang.Integer.parse(Integer.java:375)
> E/AndroidRuntime(26753): at java.lang.Integer.parseInt(Integer.java:366)
> E/AndroidRuntime(26753): at java.lang.Integer.parseInt(Integer.java:332)
> E/AndroidRuntime(26753): at android.database.MatrixCursor.getInt(MatrixCursor.java:247)
> E/AndroidRuntime(26753): at com.android.calendar.EventInfoFragment.initReminders(EventInfoFragment.java:3350)
> E/AndroidRuntime(26753): at com.android.calendar.EventInfoFragment$QueryHandler.onQueryComplete(EventInfoFragment.java:4123)
> E/AndroidRuntime(26753): at com.android.calendar.AsyncQueryService.handleMessage(AsyncQueryService.java:411)
Apparently Android is trying to parse the string "Alert" as an int, which fails. "Alert" in turn comes from RemindersMethod.Alert, suggesting that the cause is SetReminder.cs:
One quick search for "CalendarContract.Reminders.METHOD" (`InterfaceConsts` is a Xamarin-ism, so remove it when searching for Java members), and we find:
> The alarm method, as set on the server. METHOD_DEFAULT, METHOD_ALERT, METHOD_EMAIL,
> METHOD_SMS and METHOD_ALARM are possible values; the device will only process METHOD_DEFAULT
> and METHOD_ALERT reminders (the other types are simply stored so we can send the same reminder
> info back to the server when we make changes).
So the value should be e.g. METHOD_ALARM, which -- behold! -- is an int:
This would correspond to Android.Provider.CalendarContract.RemindersColumns.MethodAlert:
Which in turn suggests that SetReminder.cs _should_ do:
reminderValues.Put(CalendarContract.Reminders.InterfaceConsts.Method, (int) CalendarContract.RemindersColumns.MethodAlert);
Because we have not received a reply to our request for more information we are closing this issue. If you are still encountering this issue, please reopen the ticket with the requested information. Thanks!