Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (device)
Viewing all articles
Browse latest Browse all 250

Trying to write an event to the Android calendar

0
0

So, I am developing an app that requires to write simple events to a device calendar. It is working beautifully on iOS but Android is (yet again) proving to be finicky at best. I gave up on trying to get this to happen on the emulator and tried for an actual Android device. It still shows the same issues. It's to the point (as with the test case below) that I am pulling simple code straight from the documentation to see if I can get ANYTHING to post to the android calendar. I have done multiple searches through the Q&A here as well as Stack Overflow. I see this issue pop up every now and then but there are never any resolutions outside of using the Google Calendar API. I don't see why I would have to use that when it is going straight onto a device (totally understand it for an emulator).

Here's all of the information for this issue I am having:

Application type: mobile

Titanium SDK: Titanium SDK version 3.4.1.GA

Platform & Version: Android 4.4

Device: Android - Samsung Galaxy Note 4

Host Operating System: OSX 10.10.1

Titanium Studio: Titanium Studio, build: 3.4.1.201410281727

Simple Test Case:

Here is the addition to TI.XML:

<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>
Here is the code inside app.js:
var calendar = require("calendar");
 
var toStorage = {
    year: 2015,
    month: 1,
    day: 26,
    begin_hour: 13,
    end_hour: 14,
    title: "Eat donuts",
    desc: "I am going to eat donuts for an entire hour because they are delicious."
};
 
calendar.add(toStorage);
Here is the code inside of calendar.js:
exports.add = function(list) {
 
    var selectableCalendars = Ti.Calendar.selectableCalendars;
 
    for (var i = 0, ilen = selectableCalendars.length; i < ilen; i++) {
      console.log("name:" + selectableCalendars[i].name +",  id: " + selectableCalendars[i].id);
    };
 
    var CALENDAR_TO_USE = 3;
    var calendar = Ti.Calendar.getCalendarById(CALENDAR_TO_USE);
 
    // Create the event
    var eventBegins = new Date(list.year, list.month, list.day, list.begin_hour, 0, 0);
    var eventEnds = new Date(list.year, list.month, list.day, list.end_hour, 0, 0);
    var details = {
        title: list.title,
        description: list.desc,
        begin: eventBegins,
        end: eventEnds
    };
 
    var event = calendar.createEvent(details);
 
};
8. Logs:

Here is everything. I apologize for the text blob, but I don't know what to even look for here.

[INFO] :   Project built successfully in 29s 704ms
[INFO] :   SELinux: Function: selinux_android_load_priority , priority [2] , priority version is VE=SEPF_SM-N910T_4.4.4_A025
[ERROR] :  SELinux: [DEBUG] get_category: variable seinfocat: default sensitivity: NULL, cateogry: NULL
[ERROR] :  dalvikvm: >>>>> Normal User
[ERROR] :  dalvikvm: >>>>> com.sh.ta [ userId:0 | appId:10259 ]
[ERROR] :  SELinux: [DEBUG] get_category: variable seinfocat: default sensitivity: NULL, cateogry: NULL
[INFO] :   TiApplication: (main) [0,0] checkpoint, app created.
[INFO] :   TiApplication: (main) [350,350] Titanium 3.4.1 (2014/11/13 13:33 5982e8f)
[WARN] :   linker: libtiverify.so has text relocations. This is wasting memory and is a security risk. Please fix.
[INFO] :   TiApplication: (main) [58,408] Titanium Javascript runtime: v8
[WARN] :   linker: libstlport_shared.so has text relocations. This is wasting memory and is a security risk. Please fix.
[WARN] :   linker: libkroll-v8.so has text relocations. This is wasting memory and is a security risk. Please fix.
[WARN] :   V8Object: (KrollRuntimeThread) [103,511] Runtime disposed, cannot set property 'userAgent'
[INFO] :   TiRootActivity: (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
[INFO] :   name:My calendar,  id: 1
[INFO] :   name:Samsung Calendar,  id: 2
[INFO] :   name:jhubbard550@gmail.com,  id: 3
[INFO] :   I/dalvikvm-heap: Grow heap (frag case) to 42.873MB for 10920976-byte allocation
[INFO] :   TiRootActivity: (main) [0,0] checkpoint, on root activity resume. activity = com.sh.ta.TestappActivity@436e5f30
[INFO] :   I/Adreno-EGL: <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build:  ()
[INFO] :   I/Adreno-EGL: OpenGL ES Shader Compiler Version: E031.24.02.11
[INFO] :   I/Adreno-EGL: Build Date: 09/12/14 Fri
[INFO] :   I/Adreno-EGL: Local Branch: LA.3.6.1_20140912_070_patches
[INFO] :   I/Adreno-EGL: Remote Branch:
[INFO] :   I/Adreno-EGL: Local Patches:
[INFO] :   I/Adreno-EGL: Reconstruct Branch:
[INFO] :   HWUI: EGLImpl-HWUI Protected EGL context created
[INFO] :   qdutils: PartialUpdate status: Enabled
[INFO] :   qdutils: Left Align: 8
[INFO] :   qdutils: Width Align: 8
[INFO] :   qdutils: Top Align: 1
[INFO] :   qdutils: Height Align: 1
[INFO] :   qdutils: Min ROI Width: 1
[INFO] :   qdutils: Min ROI Height: 2
[INFO] :   qdutils: Needs ROI Merge: 1
[INFO] :   qdutils: Left Split=720
[INFO] :   qdutils: Right Split=720
[WARN] :   CursorWrapperInner: Cursor finalized without prior close()
[WARN] :   CursorWrapperInner: Cursor finalized without prior close()
[INFO] :   APSAnalyticsService: Analytics Service Started
[INFO] :   I/System.out: Thread-11414(ApacheHTTPLog):Reading from variable values from setDefaultValuesToVariables
[INFO] :   I/System.out: Thread-11414(ApacheHTTPLog):isShipBuild true
[INFO] :   I/System.out: Thread-11414(ApacheHTTPLog):SmartBonding Enabling is true, SHIP_BUILD is true, log to file is false, DBG is false
[INFO] :   I/System.out: Thread-11414 calls detatch()
[INFO] :   APSAnalyticsService: Stopping Analytics Service
[ERROR] :  File: fail readDirectory() errno=2
[INFO] :   TiRootActivity: (main) [0,0] checkpoint, on root activity resume. activity = com.sh.ta.TestappActivity@436e5f30
[INFO] :   APSAnalyticsService: Analytics Service Started
[INFO] :   APSAnalyticsService: Stopping Analytics Service
[INFO] :   APSAnalyticsService: Analytics Service Started
[INFO] :   I/System.out: Thread-11416 calls detatch()
[INFO] :   APSAnalyticsService: Stopping Analytics Service
The phone doesn't throw any errors. It doesn't write to the calendar either.

Thank you all very much in advance~


Viewing all articles
Browse latest Browse all 250

Latest Images

Trending Articles





Latest Images