mailcore2 IMAPIdleOperation stops receiving mails after 5 mins with Android library

176 Views Asked by At

mailcore2 IMAPIdleOperation stops receiving mails after 5 mins with android mailcore2 library. can anyone please provide me the sample code how to handle Imap connection for a long time.

Here is my code

public class ImapIdleNotification extends Service {

@Override
public int onStartCommand(Intent intent, int flags, int startId) {



    startIdle();


    return START_STICKY;
}

@Override
public void onDestroy() {
    super.onDestroy();

    Log.v(TAG,"Service killed");


}

public void startIdle() {

    final IMAPIdleOperation imapIdleOperation = MessagesSyncManager.singleton().session.idleOperation("INBOX", 1888 );

        imapIdleOperation.start(new OperationCallback() {
            @Override
            public void succeeded() {

                Log.v("Mailcore","...................Received new mail.........."+);

            }

            @Override
            public void failed(MailException e) {
                e.printStackTrace();

            }
    });
}

}

IDlE operation stops when the message display on the console.

2-27 17:34:32.461 4910-4910/com.crm.mail I/MCOperationQueue.cpp: trying to quit 0xb4a07c00
12-27 17:34:32.462 4910-4934/com.crm.mail I/MCOperationQueue.cpp: stopping 0xb4a07c00
12-27 17:34:32.462 4910-4910/com.crm.mail I/MCOperationQueue.cpp: thread stopped 0xb4a07c00
12-27 17:34:32.462 4910-4934/com.crm.mail I/MCOperationQueue.cpp: cleanup thread 0xb4a07c00
0

There are 0 best solutions below