Events are not displayed on android device, while displayed on browser

Hi @all

I have developed an app ionic v1. and I am fetching events from server (web-service) to display them in app using ionic-calendar. So while testing it on browser its displaying the events fine on calendar, but the issue is while generating apk and testing it on real device its not showing the events even without any exception or error.

Is there anything / setting need to do for calendar to work it on device.

Anyone faced this issue before, please assist.

//Controller.js

app.controller('CalendarEventCtrl', function ($scope,$http,$state,$ionicLoading,$ionicPopup,EventService,sessionService,AuthService,$controller) {  
$scope.calendar = {};    
//Load all events on click
$scope.loadEvents = function (){                    
    $ionicLoading.show();        
    EventService.getEvents().then(function (response) {
            if(response.data){                  
            if(response.data.MessageId == 1){//Grant                           
                var events = [];        
        for (var i = 0; i < response.data.data.allEvents.length; i += 1) {  
              var date = new Date();
              events.push({ 
                    title: 'Event - ' + response.data.data.allEvents[i]['title'],
                    startTime: response.data.data.allEvents[i]['field_date4'],
                    endTime: response.data.data.allEvents[i]['field_date4'],
                    allDay: false,                    
                    date:response.data.data.allEvents[i]['field_date4']
            });  
        }        
   $scope.calendar.eventSource = events;
   sessionService.store('allEventsServer', events); 

   $state.go("eventcalender"); 
});

//Service response.

{"MessageId":1,"data":{"allEvents":[{"title":"4TH AMANJIT MEMORIAL SIX-A-SIDE CRICKET TOURNAMENT 2017","field_date4":"2017-04-15T00:00:00"},{"title":"38TH FOUNDER\u0027S DAY 2017","field_date4":"2017-04-09T00:00:00"},{"title":"INTER SCHOOL IT COMPETITION 2016","field_date4":"2016-12-03T00:00:00"},{"title":"ALL INDIA IPSC UNDER-19 GIRLS BASKETBALL TOURNAMENT-2016","field_date4":"2016-10-31T00:00:00"},{"title":"INTER-HOUSE ANNUAL ATHLETICS MEET 2015","field_date4":"2015-12-17T00:00:00"},{"title":"KINDERGARTEN PRESENTS A MUSICAL \u2018ALL THINGS BRIGHT AND BEAUTIFUL\u2019","field_date4":"2015-12-12T00:00:00"},{"title":"YPS, MOHALI HOSTS \u2018SYMPHONY\u2019 MUSIC OF THE SPHERES  A FESTVAL OF MUSIC AND DANCE 2015","field_date4":"2015-12-04T00:00:00"},{"title":"YADAVINDRA PUBLIC SCHOOL, MOHALI HOSTS INTER-SCHOOL IT FEST 2015","field_date4":"2015-11-28T00:00:00"},{"title":"2ND AMANJIT SINGH MEMORIAL SIX-A-SIDE CRICKET TOURNAMENT","field_date4":"2015-04-12T00:00:00"},{"title":"XXXVIth FOUNDER\u0027S DAY CELEBRATIONS","field_date4":"2015-04-09T00:00:00"}]}}

please make it clean before you post like if you have a code make sure you use </> and reviewing it in the right side panel if it is readableā€¦

Yes, done.thanks mate

I have resolved it myself.

Thanks

Could you share how you solved it please?

It was date format issue. Android 6 >= version was not supporting the date format as I used above.

startTime: new Date(Date.UTC(date1[0],(date1[1]-1),date1[2])),
endTime:new Date(Date.UTC(date1[0],(date1[1]-1),date1[2]))

It should be like that. then it will work on both Android and IOS as well.