Thanks for the reply TreKing. Actually I now tried to use startForeground(). Notification icon is hanging in the bar, but whenever I send an intent to a Service it doesnt seem to receive it, does it mean its dead?
On Mar 19, 6:30 am, TreKing <treking...@gmail.com> wrote: > On Sun, Mar 18, 2012 at 3:44 PM, svl <s.i.vladimi...@googlemail.com> wrote: > > The question is - how i can make sure that the thread keeps running? > > You can't, not without any guarantee. > > > Another solution was to do it with a handler and run the read from > > serial port every second. Unfortunately that blocked the whole > > application and it was hanging. > > Were you running in the UI thread? Is there a UI thread on Service? I just created a Runnable in onStartCommand and called handlers postInTheQueue to execute runnable. > > > So basically i need to make service that constantly reads from serial > > port. > > Use IntentService and don't try to run for 10 minutes straight. Or set it > up such that you can recover and continue from where you were if you are > killed (the OS will try to restart your Service to let it run to completion > if it had to kill it, if you return the correct STICKY flag). Whats the difference between Sevice and IntentService? I do return STICKY.... > > --------------------------------------------------------------------------- > ---------------------- > TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago > transit tracking app for Android-powered devices -- 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en