开发者

Android Foreground Service Help [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.

Closed 9 years ago.

Improve this question

I'm working on an application that requires I run a long process in the foreground (mostly download开发者_JS百科ing a few large files), however, after much searching, and googling I have been unable to turn up a tutorial or example on foreground services. I've never used a foreground service so I'm a bit lost at the moment. Could anyone lend a hand on basic foreground services, maybe some sample code on starting one and ending one?

Thank you


An example is given in the developer guide over here.


You should be using an AsyncTask if it's running in the foreground.

With an AsyncTask you can run things in the UI on progress updated with activity.runOnUiThread(new Runnable())

Give this a try, see if it is what you're looking for :)

Hope this helped.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜