Issue
Error when trying to get the events from a calendar on Galaxy Tab 7+ - android 3.2 on it.
To reproduce
1. Run code below
2. Monitor console output i.e. eGomez-MacBook-Pro:platform-tools egomez$ ./adb -d logcat
Repro sequence
Titanium.UI.setBackgroundColor('#000');
var win = Titanium.UI.createWindow({
title:'Calendar',
backgroundColor:'#fff'
});
win.open();
function showCalendars(calendars) {
for (var i = 0; i < calendars.length; i++) {
Ti.API.info(calendars[i].name);
Ti.API.info(JSON.stringify(calendars[i]));
}
}
Ti.API.info('ALL CALENDARS:');
showCalendars(Ti.Android.Calendar.allCalendars);
Ti.API.info('SELECTABLE CALENDARS:');
showCalendars(Ti.Android.Calendar.selectableCalendars);
// SHOW ALL EVENTS FOR 2010 FOR ONE CALENDAR
var YEAR = 2012;
var TEST_WITH_THIS_CAL_ID = 1;
var calendar = Ti.Android.Calendar.getCalendarById(TEST_WITH_THIS_CAL_ID);
var events = calendar.getEventsInYear(YEAR);
if (events && events.length) {
Ti.API.info(events.length + ' event(s) in ' + YEAR);
for (var i = 0; i < events.length; i++) {
Ti.API.info(JSON.stringify(events[i]));
}
} else {
Ti.API.info('No events');
}
var CALENDAR_TO_USE = 1;
var calendar = Ti.Android.Calendar.getCalendarById(CALENDAR_TO_USE);
// Create the event
var eventBegins = new Date(2012, 03, 26, 12, 0, 0);
var eventEnds = new Date(2012, 03, 26, 14, 0, 0);
var details = {
title: 'Do some stuff',
description: "I'm going to do some stuff at this time.",
begin: eventBegins,
end: eventEnds
};
var event = calendar.createEvent(details);
// Now add a reminder via e-mail for 10 minutes before the event.
var reminderDetails = {
minutes: 10,
method: Ti.Android.Calendar.METHOD_EMAIL
};
event.createReminder(reminderDetails);
<android xmlns:android="http://schemas.android.com/apk/res/android">
<manifest>
<uses-permission android:name="android.permission.READ_CALENDAR"/>
<uses-permission android:name="android.permission.WRITE_CALENDAR"/>
</manifest>
</android>
LG Ally Android 2.2 device
I/ActivityManager( 1345): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.appcelerator.com/.T15422Activity }
I/ActivityManager( 1345): Start proc com.appcelerator.com for activity com.appcelerator.com/.T15422Activity: pid=3555 uid=10071 gids={1015, 3003}
I/TiApplication( 3555): (main) [0,0] checkpoint, app created.
I/TiApplication( 3555): (main) [220,220] Titanium 2.0.0 (2012/02/16 18:01 f0ea3e8)
I/TiApplication( 3555): (main) [549,769] Titanium Javascript runtime: v8
I/TiRootActivity( 3555): (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
E/TiApplication( 3555): (KrollRuntimeThread) [1680,1680] APP PROXY: ti.modules.titanium.app.AppModule@44a607d0
I/TiAPI ( 3555): ALL CALENDARS:
I/TiAPI ( 3555): eduardo.www@gmail.com
I/TiAPI ( 3555): {"hidden":false,"id":"1","selected":true,"name":"eduardo.www@gmail.com"}
I/TiAPI ( 3555): SELECTABLE CALENDARS:
I/TiAPI ( 3555): eduardo.www@gmail.com
I/TiAPI ( 3555): {"hidden":false,"id":"1","selected":true,"name":"eduardo.www@gmail.com"}
I/TiAPI ( 3555): 2 event(s) in 2012
I/TiAPI ( 3555): {"hasExtendedProperties":true,"alerts":[],"reminders":[{"id":"1","method":2,"minutes":10}],"allDay":false,"recurrenceRule":null,"description":"I'm going to do some stuff at this time.","id":"1","visibility":0,"recurrenceExceptionRule":null,"lastDate":null,"end":"2012-04-26T20:00:00.000Z","status":0,"title":"Do some stuff","begin":"2012-04-26T18:00:00.000Z","hasAlarm":true,"location":null,"recurrenceDate":null,"recurrenceExceptionDate":null,"extendedProperties":{}}
I/TiAPI ( 3555): {"hasExtendedProperties":true,"alerts":[],"reminders":[{"id":"2","method":2,"minutes":10}],"allDay":false,"recurrenceRule":null,"description":"I'm going to do some stuff at this time.","id":"2","visibility":0,"recurrenceExceptionRule":null,"lastDate":null,"end":"2012-04-26T20:00:00.000Z","status":0,"title":"Do some stuff","begin":"2012-04-26T18:00:00.000Z","hasAlarm":true,"location":null,"recurrenceDate":null,"recurrenceExceptionDate":null,"extendedProperties":{}}
D/TiEvents( 3555): (KrollRuntimeThread) [624,2304] created event with uri: content://com.android.calendar/events/3
D/TiEvents( 3555): (KrollRuntimeThread) [33,2337] created reminder with uri: content://com.android.calendar/reminders/3, minutes: 10, method: 2, event_id: 3
I/TiRootActivity( 3555): (main) [0,0] checkpoint, on root activity resume. activity = com.appcelerator.com.T15422Activity@449cdf08
I/ActivityManager( 1345): Displayed activity com.appcelerator.com/.T15422Activity: 4798 ms (total 4798 ms)
W/TiAnalyticsSvc( 3555): (Thread-12) [27735,27735] Analytics Service Started
I/TiAnalyticsSvc( 3555): (Thread-12) [45,27780] Network unavailable, can't send analytics
W/TiAnalyticsSvc( 3555): (Thread-12) [0,27780] Stopping Analytics Service
Galaxy Tab 7+ with android 3.2 - from customer
03-09 17:01:42.739: I/SqliteDatabaseCpp(4233): sqlite returned: error code = 1, msg = no such column: Calendars._id, db=/data/data/com.android.providers.calendar/databases/calendar.db
03-09 17:01:42.739: E/DatabaseUtils(4233): Writing exception to parcel
03-09 17:01:42.739: E/DatabaseUtils(4233): android.database.sqlite.SQLiteException: no such column: Calendars._id: , while compiling: SELECT Instances.event_id AS event_id, title, description, eventLocation, begin, end, allDay, hasAlarm, eventStatus, visibility FROM Instances INNER JOIN view_events AS Events ON (Instances.event_id=Events._id) WHERE (begin<=? AND end>=?) AND (Calendars._id=1) ORDER BY startDay ASC, startMinute ASC
03-09 17:01:42.739: E/DatabaseUtils(4233): at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
03-09 17:01:42.739: E/DatabaseUtils(4233): at android.database.sqlite.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:64)
03-09 17:01:42.739: E/DatabaseUtils(4233): at android.database.sqlite.SQLiteProgram.compileSql(SQLiteProgram.java:146)
03-09 17:01:42.739: E/DatabaseUtils(4233): at android.database.sqlite.SQLiteProgram.compileAndbindAllArgs(SQLiteProgram.java:367)
03-09 17:01:42.739: E/DatabaseUtils(4233): at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:130)
03-09 17:01:42.739: E/DatabaseUtils(4233): at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:94)
03-09 17:01:42.739: E/DatabaseUtils(4233): at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:46)
03-09 17:01:42.739: E/DatabaseUtils(4233): at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:47)
03-09 17:01:42.739: E/DatabaseUtils(4233): at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1539)
03-09 17:01:42.739: E/DatabaseUtils(4233): at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:330)
03-09 17:01:42.739: E/DatabaseUtils(4233): at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:280)
03-09 17:01:42.739: E/DatabaseUtils(4233): at com.android.providers.calendar.CalendarProvider2.handleInstanceQuery(CalendarProvider2.java:1237)
03-09 17:01:42.739: E/DatabaseUtils(4233): at com.android.providers.calendar.CalendarProvider2.query(CalendarProvider2.java:982)
03-09 17:01:42.739: E/DatabaseUtils(4233): at android.content.ContentProvider$Transport.bulkQuery(ContentProvider.java:179)
03-09 17:01:42.739: E/DatabaseUtils(4233): at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:111)
03-09 17:01:42.739: E/DatabaseUtils(4233): at android.os.Binder.execTransact(Binder.java:339)
03-09 17:01:42.739: E/DatabaseUtils(4233): at dalvik.system.NativeStart.run(Native Method)
03-09 17:01:42.809: E/TiJSError(8945): (main) [187,477] ----- Titanium Javascript Runtime Error -----
03-09 17:01:42.809: E/TiJSError(8945): (main) [0,477] - In app.js:53,23
03-09 17:01:42.809: E/TiJSError(8945): (main) [0,477] - Message: Uncaught Error: no such column: Calendars._id: , while compiling: SELECT Instances.event_id AS event_id, title, description, eventLocation, begin, end, allDay, hasAlarm, eventStatus, visibility FROM Instances INNER JOIN view_events AS Events ON (Instances.event_id=Events._id) WHERE (begin<=? AND end>=?) AND (Calendars._id=1) ORDER BY startDay ASC, startMinute ASC
03-09 17:01:42.809: E/TiJSError(8945): (main) [1,478] - Source: var events = calendar.getEventsInYear(YEAR);
I can help with my galaxy tab 7+ for testing if needed. Thank you.
Tested on
2.0.0.v20120312104735Test case passed on 2.3, 3.1 and 3.2 devices, but failed on 4.0 device. The crash log on 4.0 device is the following for V8:
And for Rhino:
New ticket 8053 has been opened to address adding Calendar support for ICS.
Closing issue Tested with Ti Studio build 2.0.0.201203182248 Ti Mob SDK 2.0.0.v20120319003254 hash r60b6da4c OSX Lion 10.7.3 Galaxy Tab 10.1 OS 3.2, Galaxy Tab 2.3.4 On both devices the expected console output is shown
The calendar_id bug is fixed, but it triggers another error as I specified in the ticket. http://support.appcelerator.com/tickets/APP-744758/tickets
Refer to linked timob-8085 to track newly reported issue
Exception occurred on the console while executing the app. Timob_7959_exception.txt is attached. Tested on: Device : Google Nexus 7, Android Version: 4.1 SDK: 3.1.1.v20130531163723 CLI version : 3.1.0 OS : MAC OSX 10.7.5 Appcelerator Studio, build: 3.1.1.201306012403 XCode : 4.5.1
I ran the test case on Nexus 7 (4.1) with the latest 3.1.1 and it works fine. From the attached log, it is not a calendar issue but something related network. Resolve the ticket as Fixed.
Anvil test case added. https://github.com/appcelerator/titanium_mobile/pull/4944
Closing ticket as fixed.