If I were you assuming everything is working now and your app isn't crashing, I would put the code you want to run in the background into your service. If you need to save any data save it to a SQLlite database or xml file or whatever. I would then create a notification icon in the top menu of the phone. When the user clicks the icon have it launch your activity there. Inside your activity either in onResume or onStart have it pull the most recent data from you DB or xml file. Now when the user closes your app it will stil have the service running and the next time the enter the app your activity will refresh itself from the database or other file.
From: [email protected] [mailto:[email protected]] On Behalf Of Cythes Sent: Friday, July 13, 2012 6:42 PM To: [email protected] Subject: Re: [android-developers] Re: Service launch issues Actually to be specific I am looking to make my main activity run from the service via intent. however if need be I can just take my code from the main activity, I can just put the code into the service. On Friday, July 13, 2012 5:39:22 PM UTC-4, Tommy wrote: Activities have to run in the foreground. Services run in the background. Maybe we are just misunderstanding. What exactly do you want to run in the background? From: [email protected] [mailto:[email protected]] On Behalf Of Cythes Sent: Friday, July 13, 2012 5:20 PM To: [email protected] Subject: Re: [android-developers] Re: Service launch issues I seem to be getting "This isn't possible" quite a bit. I know I'm not a genius at this stuff in fact I'm far from it but every time someone says that I have been finding usable workaround's. Please note this is not me being cocky. Just something I am noticing. On Friday, July 13, 2012 5:04:25 PM UTC-4, MagouyaWare wrote: Wait, I just realized something... you are wanting your activity to run in the background? AFAIK this isn't possible... why are you wanting to do this? Thanks, Justin Anderson MagouyaWare Developer http://sites.google.com/site/magouyaware On Fri, Jul 13, 2012 at 2:58 PM, Nobu Games <[email protected]> wrote: http://stackoverflow.com/questions/11476906/service-launches-then-crashes If you feel like cross-posting your own questions then please take the advice of the guys over at Stackoverflow seriously and post the exception message / log cat / stack trace, too. "It crashes after 30 seconds" can have a billion different reasons. -- 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] <mailto:android-developers%[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 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 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 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

