高优先级的Andr​​oid服务优先级、Andr、oid

由网友(抑制不住思念)分享简介:我在寻找到针对Android实现过的蓝牙视频流服务。I'm looking into implementing an over-Bluetooth video streaming service for Android.我如何确保:在该服务具有高优先级运行?我想,以减少等待时间。的服务是低的东西名单当内存吃紧被杀...

我在寻找到针对Android实现过的蓝牙视频流服务。

I'm looking into implementing an over-Bluetooth video streaming service for Android.

我如何确保:

在该服务具有高优先级运行?我想,以减少等待时间。 的服务是低的东西名单当内存吃紧被杀害?

推荐答案

有两个重要的事情,你需要做,以确保您的服务继续运行:

There are two important things you need to do to make sure your service keeps running:

请确保你调用 startService()代替(或补充)的结合。这将确保该服务继续运行,即使创建它的活动被杀死。

Make sure you call startService() instead of (or in addition to) binding. This will make sure that the service continues running, even if the Activity that created it is killed.

使用 startForegroud()运行在前台的服务,让Android将不会回收它时,所需的内存。它需要你也可以创建一个通知,获取服务时实际启动,将在通知区域的图标,让用户知道你的服务仍在运行发布的。

Use startForegroud() to run the service in the foreground, so that Android won't reclaim it when memory is needed. It requires that you also create a Notification that gets published when the service actually starts, putting an icon in the notification area and letting the user know your service is still running.

有关详细信息:

http://developer.android.com/reference/android/app/Service.html http://developer.android.com/guide/topics/fundamentals/bound-services.html

阅读全文

相关推荐

最新文章