Warning : Launch Time Out Expired , Giving wake up lock

2,097 views
Skip to first unread message

pradeep

unread,
Jul 26, 2011, 7:06:34 PM7/26/11
to android-ndk
Hi ,
I am writing an apk and that does TCP/IP socket programming . It runs
fine most of the times but sometimes logcat displays this warning and
my apk gets hung at that point. I tried googling about this , but
didn't get any concrete answer.
/ActivityManager( 161): Launch timeout has expired, giving up wake
lock!
W/ActivityManager( 161): Activity idle timeout for
ActivityRecord{40ac3380 com.example.hellojni/.HelloJni}
what exactly does this error mean ? Reason for this error ?

-Pradeep.

Olivier Guilyardi

unread,
Jul 26, 2011, 8:02:18 PM7/26/11
to andro...@googlegroups.com

It very likely means that you are blocking the main UI thread while waiting on
socket I/O. You need to perform network operations in a background thread, and
publish results on the UI thread asynchronously.

--
Olivier


pradeep

unread,
Jul 26, 2011, 8:18:38 PM7/26/11
to android-ndk
Thanks will explore further on this end.

pradeep

unread,
Jul 27, 2011, 2:27:02 PM7/27/11
to android-ndk
Thanks it worked , As explained I created a background thread , it is
running fine now.

For those who want create AsyncTask(background thread) and threads:
> http://developer.android.com/reference/android/os/AsyncTask.html
>http://code.google.com/p/makemachine/source/browse/#svn%2Ftrunk%2Fandroid%2Fexamples%2Fasync_task%2Fsrc%2Fmakemachine%2Fandroid%2Fexamples%2Fasync

pradeep

unread,
Jul 27, 2011, 2:28:51 PM7/27/11
to android-ndk
Thanks it worked , as explained it was problem with the blocking in
UI thread.

For those who want to create background threads:

Olivier Guilyardi

unread,
Jul 27, 2011, 3:02:15 PM7/27/11
to andro...@googlegroups.com
You're welcome. Yes, AsyncTask is an option, but you could also have used
pthread directly.

Olivier

Reply all
Reply to author
Forward
0 new messages