First of all, congrats for not doing this with an AsyncTask.

Second, as of Honeycomb, you may not touch the network from the UI thread 
(as you've probably surmised by now).  The fact that you are getting that 
error message suggest to me that you are using a Handler *attached to the 
UI thread* You can't do that.

TreKing's suggestion of an alarm, scheduled with the alarm manager, coupled 
with an intent service, is probably a good way to go.  The Alarm manager 
fires a PendingIntent at the IntentService.  When the IntentService gets 
the intent, it runs the server check.

-blake


On Tuesday, January 29, 2013 11:47:39 AM UTC-5, Diego Nunes wrote:
>
> Good afternoon.
>
> I need from time to time do a check on a server, because I'm not using 
> AsyncTask do not need no update from my view.
>
> Then I used a Handler that runs a thread from time to time, and this 
> thread makes access to the server. In Honeycomb versions running down blz, 
> already in top get a exception: android.os.NetworkOnMainThreadException.
>
> Someone uses a different strategy to do this kind of task?
>
> Thank you.
>
> ---------------------------------------
> Diêgo Nunes Assunção
> "Give Peace a Chance" 
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to