如何使我的Android应用程序在后台运行 [英] How can I make my android application run in background

查看:69
本文介绍了如何使我的Android应用程序在后台运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发了一个应用程序,该应用程序每30秒从前置摄像头拍摄一次图像.当我按下后退按钮时,我的应用程序停止.我想在后台运行我的应用程序,但我不知道该怎么做.任何帮助将不胜感激..

I have developed an application which take image from front camera after every 30 seconds. When I press the back button my application stops. I want to run my application in background and I have no idea how to do it. Any help will be appreciated..

推荐答案

您可以使用IntentService.它在后台线程上运行,不受UI生命周期的影响.您可以在Android开发者文档中此处找到有关使用方法的信息

You can use an IntentService. It runs on a background thread and is not affected by UI lifecycles. You can reach about how to use it here in the Android Developer Docs

这篇关于如何使我的Android应用程序在后台运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆