Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24464] Android: Ti.Calendar.Calendar.getEventsBetweenDates returns same events for all calendars

GitHub Issuen/a
TypeBug
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2017-05-02T00:13:27.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.1.0
ComponentsAndroid
Labelsandroid
ReporterKiley Williams
AssigneeHans Knöchel
Created2016-12-14T17:26:17.000+0000
Updated2018-02-21T10:41:53.000+0000

Description

On my test device, there are 15 calendars, some are duplicates (via being linked through different google accounts on the same device), and some are not duplicates. Let X be the events returned from the first calendar. When executing the "Ti.Calendar.Calendar.getEventsBetweenDates" method on all calendars, they all return X. This is problematic, because we then cannot differentiate between which Calendars from which data is being pulled. A use cannot exclude certain calendars from being consumed by the application, which is a major issue. NOTE: On iOS, this exact same scenario and code results in the proper data being returned from the specific Calendars.

Comments

  1. Sharif AbuDarda 2016-12-15

    Hello, Please share a sample code to test the issue.
  2. Kiley Williams 2016-12-15

       // Step 0: Get Permission for calendar access on Android device
       
       // Step 1: Get All Calendars for Android Device
       
       // Step 2: Loop over calendars for Android Device
       
       var events_between_dates = current_calendar_object.getEventsBetweenDates(start_date, end_date);
       
       Ti.API.log('number of events between date: ' + events_between_dates.length'); // Observe that the number of events between dates is the same for all calendars. The events are also all the same.
       
       
  3. Sharif AbuDarda 2016-12-21

    Hello, Your sample code is not sufficient enough. Please attach a sample project that regenerates the issue. Thanks.
  4. Kiley Williams 2017-03-08

    Sharif, this was unnecessarily closed, and I was not about to rewrite an entire test application for you. It's an easy check to see (by using your sample code from the Appcelerator documentation site) that the calendars yield the same results, even if you specify them explicitly. In my case, no matter if I chose 1 or 15 calendars, it still yielded the same result. See line 240 of EventProxy.java in the titanium_mobile SDK. return queryEventsBetweenDates(date1, date2, null, null); should actually be return queryEventsBetweenDates(date1, date2, "calendar_id=" + calendar.getId(), null); I'm not submitting a PR and all of that jazz for this, because it can be resolved by one of you quite quickly. There's your answer, I made the change myself in my customized SDK and it works fine.
  5. Hans Knöchel 2017-03-08

    Reopening issue, it's valid and reproducible.
  6. Hans Knöchel 2017-03-08

    Community-PR: https://github.com/appcelerator/titanium_mobile/pull/8867
  7. Kiley Williams 2017-03-08

    Thanks
  8. Lokesh Choudhary 2017-05-02

    FR passed for 6.2.0. Need a backport for 6.1.0.
  9. Hans Knöchel 2017-05-09

    PR (6_1_X): https://github.com/appcelerator/titanium_mobile/pull/9042
  10. Lokesh Choudhary 2017-05-15

    Verified the fix with 6.1.0.v20170514022959 & 6.2.0.v20170512073825. calendar.getEventsBetweenDates returns correct number of events. Closing. Studio Ver: 4.9.0.201705110256 SDK Ver: 6.1.0.v20170514022959 OS Ver: 10.12.3 Xcode Ver: Xcode 8.3.2 Appc NPM: 4.2.9 Appc CLI: 6.2.1 Ti CLI Ver: 5.0.13 Alloy Ver: 1.9.11 Node Ver: 6.10.1 Java Ver: 1.8.0_101 Devices: ⇨ google Nexus 6 --- Android 6.0.1 ⇨ google Nexus 6P --- Android 7.1.1
  11. Michiel van Eerd 2018-02-21

    On SDK 7.0.2.GA all events have the same id when calling getEventsBetweenDates(). When calling getEventsInDate() the have the correct id's.

JSON Source