Friday, November 23, 2012

Re: [android-developers] Re: Blocked my UI thread by background service

Hello Jonathan,

Thanx a lot for suggestion to use IntentService, now my app doesn't block UI thread, it works perfectly.

again Thank you.
   

On Sat, Nov 10, 2012 at 3:05 AM, Jonathan S <xfsunoles@gmail.com> wrote:
Why you are not using IntentService? that class stop the service when it finished.


On Friday, November 9, 2012 3:21:25 PM UTC-5, Rajan wrote:
What i need to do
=============
1. I need to get Latitude & longitude every 1 min.
2. after getting this lat & long, i need to call one web service through which i have to send <latitude, longitude, TAG>

TAG is kind of "ON" or "OFF" text :  that can be set on button press event.
 
What i have done
=============
1. i created one simple service that can be use to get lat & long 
and also use AsynTask inside the service for calling a webservice
 
2. i have use Time class for ping after every 1 min.

3. now i need to add TAG value inside the background service using on button pressed event : that i have already done 

[ like : 

Intent i = new Intent(this, BackgroundService.class); 
i.putExtra("TAG","ON"); 
startService(i); 
]

My Problem
=========

it block my UI thread after every 1 min. , means when my time is going to ping a backgroundService for finding a lat & long at that time it will block my UI for few seconds.
so how can i prevent my UI thread ??

Note : for start & stop to the background service, i have use Handler class & Message class 

please help me i'm stuck in this scenario since last 2 to 3 days, i didn't find any single way to prevent my UI thread.

thank you.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en



--
.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate