Calendar-PhoneGap-Plugin icon indicating copy to clipboard operation
Calendar-PhoneGap-Plugin copied to clipboard

Android 4.4 (Cyanogen Mod) createEvent issue

Open weshardee opened this issue 11 years ago • 14 comments

On a Galaxy S3 running Android 4.4 (Cyanogen Mod), using createEvent or createEventWithOptions fires the success callback but no event is added to my calendar. Using createEventInteractively seems to work perfectly.

weshardee avatar Aug 18 '14 21:08 weshardee

Hi i am running Android 4.4 (Cyanogen Mod) on my Oneplus One and same issue.

kvilt avatar Sep 04 '14 11:09 kvilt

I'm experiencing the same behavior (createEvent, and createEventWithOptions not adding an event, but interactive works) on a Nexus 7 running 4.4.2. Don't know if it's a similar, but wanted to add my observation to the pile.

premiumFrye avatar Oct 14 '14 22:10 premiumFrye

Please share your JS code with me so I can reproduce it. I have no trouble with various of my own Android devices.

EddyVerbruggen avatar Oct 30 '14 19:10 EddyVerbruggen

Hi, I write the problem I've found here, because I think is related. I'm running a stock 4.3 on Samsung Nexus, I add an event with the following code: var startDate = new Date(2015,0,21,18,30,0,0,0); // beware: month 0 = january, 11 = december var endDate = new Date(2015,0,21,19,90,0,0,0); var title = "My nice event"; var location = "Home"; var notes = "Some notes about this event."; var success = function(message) { alert("Success: " + JSON.stringify(message)); console.log(message); }; var error = function(message) { alert("Error: " + message); }; window.plugins.calendar.createEvent(title,location,notes,startDate,endDate,success,error); When I run this code, the event is added correctly, but disappears after a few seconds. I discover (using window.plugins.calendar.listCalendars(success,error); ) that the calendar with id = 1 is the holiday one, so createEvent try to add the event and then, after few seconds (after sync), google delete it. From the log of my device: E/EventHandler(24718): com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden E/EventHandler(24718): { E/EventHandler(24718): "errors": [ E/EventHandler(24718): { E/EventHandler(24718): "reason": "forbidden", E/EventHandler(24718): "domain": "global", E/EventHandler(24718): "message": "Forbidden" E/EventHandler(24718): } E/EventHandler(24718): ], E/EventHandler(24718): "message": "Forbidden", E/EventHandler(24718): "

Redeadly avatar Jan 20 '15 14:01 Redeadly

On a MX2 running 4.4.4, createEvent doesn't add anything when called, on a MX4 running 4.4.2 it works fine.

centimitr avatar Feb 22 '15 12:02 centimitr

I'm experiencing the issue with createEvent, vs createEventWithOptions not adding an event in the emulator using a 4.4.2 device (api 19). The interactive method works though. Same thing for my physical device, which is 5.0 on a Moto X (verizon). I took the code verbatim from the example in the readme

sixkilleraz avatar Mar 24 '15 21:03 sixkilleraz

@Centimitr and @sixkilleraz do you recognize the symptoms of @Redeadly?

Also, @sixkilleraz can you please paste the exact code you're using? Thx!

EddyVerbruggen avatar Mar 24 '15 21:03 EddyVerbruggen

Here's the code. The event object is valid, since I'm able to use the method createEventInteractively successfully. I will try to get a device log today for you. Thanks!

  function addToDevice() {
    var deferred = $q.defer();

    var startDate = $scope.event.time;
    var endDate = new Date(startDate);
    endDate.setMinutes(endDate.getMinutes() + 30);
    var title = $scope.event.title;
    var eventLocation = $scope.event.location;
    var notes = $scope.event.notes;
    var success = function(message) {
      deferred.resolve(message);
    };
    var error = function(message) {
      deferred.reject(message);
    };
    window.plugins.calendar.createEvent(
      title,
      eventLocation,
      notes,
      startDate,
      endDate,
      success,
      error);

    return deferred.promise;
  }

sixkilleraz avatar Mar 25 '15 20:03 sixkilleraz

My logs are not showing the issue @Redeadly encountered.

I do have several different calendars, starting at id 14. The first one in the list is a calendar I can write to, though.

Here's all I can see in the logs. Probably not much help:

D/Calendar(28297): Added to ContentResolver

W/PluginManager(28297): THREAD WARNING: exec() call to Calendar.createEventWithOptions blocked the main thread for 71ms. Plugin should use CordovaInterface.getThreadPool().

W/BindingManager(28297): Cannot call determinedVisibility() - never saw a connection for the pid: 28297

D/SoftKeyboardDetect(28297): Ignore this event

I/CalendarProvider2(28702): Sending notification intent: Intent { act=android.intent.action.PROVIDER_CHANGED dat=content://com.android.calendar }

W/ContentResolver(28702): Failed to get type for: content://com.android.calendar (Unknown URL content://com.android.calendar)


sixkilleraz avatar Mar 26 '15 19:03 sixkilleraz

Same issue for Android 4.4 on my Oneplus One - createEventWithOptions and findEvent blocked the main thread for 27ms. Plugin should use CordovaInterface.getThreadPool(). Is there a fix for this? Please let me know.

cjjyao avatar Apr 28 '15 10:04 cjjyao

I just found out what the cause of this problem on my Oneplus One - I had successful callback with createEventWithOptions, but the event's not added. The problem was that there were multiple accounts in the calendar. Make sure the calendar your app is writing to is the same one you're viewing, or else it'll seem like the events weren't added. Using createEventInteractively allows you to select which account the event is added.

cjjyao avatar Jun 02 '15 12:06 cjjyao

I'm having the same problem, but it's happening with createEventInteractively as well. The success callback is called, but upon checking the calendar, nothing is there.

I'm running on a Nexus 5, with Android 5.1.1

raphaeltm avatar Jun 12 '15 00:06 raphaeltm

Any update on this? I am having the same issue. The success callback to called but when I look at my calendar this is no record saved. On Nexus 5 with Android 6.0.1.

hemrajdev24000 avatar Dec 12 '16 19:12 hemrajdev24000

08-16 18:26:54.681  2583  8239 E AppUsageEventWatcher: wrong time range: [1675419249681, 1534424214681)
08-16 18:26:55.152  7810  8136 W ContentResolver: Failed to get type for: content://com.android.calendar (Unknown URL content://com.android.calendar)
08-16 18:26:55.157  7323  7453 D Calendar: Created event with ID 16548
08-16 18:26:55.170  7810  8136 E DatabaseUtils: Writing exception to parcel

getting same issue on android P beta. success callback to called but no event is created plus this error in logcat


Update I was able to resolve it by passing calender id

  1. List calenders and get id
  2. Create Event

harshzalavadiya avatar Aug 14 '18 13:08 harshzalavadiya