Question

I am using wakefull intent service and works very fine. But currently i see that many times my intent service is in wait satate.I found that problem is with javamail as it goes in deadlock state when ever internet connection is resets.

I search option to intrupt operation java mail but can't find any solution.I have set IMAP,SMTP Time out property but it is not working.

                 if(msg1[0]!= null)
         {
             if(!Mail.store.isConnected() || f== null)
             {
                 Log.v(tag, "StoreNot Connected");
                 m = new Mail(username, password);
                 f =m.getlable("Message_"+nick);    
                 Log.v(tag, "Store Connected");

             }
             try{
                 Log.v(tag, "Sending Mail");    
                 //Get DeadLock Hear
                 f.appendMessages(msg1);     

                 sucess_flag=1;
                 Log.v(tag, "Mail Send");
             }
             catch(Exception e)
             {
                e.printStackTrace(); 

             }catch(Throwable e)
             {
                    e.printStackTrace(); 
             }

         }

So now i am looking for an option to restart or kill the current intent service.

Is there any option for this?

If not then is it a good idea to create theads from intentservice and kill them instead?

Was it helpful?

Solution

Try this:

Intent GPSService = new Intent(context, TrackGPS.class);
context.stopService(GPSService);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top