2013-05-10 68 views
4

我有一項活動,通過我的服務的android:process屬性在單獨進程中啓動服務。當查殺活動進程時服務重新啓動

我的服務onStartCommand()函數返回START_STICkY

我通過最近的應用程序按鈕刷掉我的活動進程,服務進程重新啓動。

我想知道是否有辦法在活動進程被終止時保持服務運行。

+0

您是否找到解決方案了? – 2014-01-16 13:52:19

+0

@Perry_ml不幸的是。我已經放棄了這個項目。 – 2014-01-16 17:29:55

回答

0
I want to know if there is a way to keep the service running when the activity process is killed. 

不,沒有辦法保持服務運行。因爲,

Closed by the user via the Running Services screen in Settings. 

Closed by the user via a task killer. 

Closed by Android to free up memory in times of need. 

Keep the service running is BAD idea.

但是你可以做,

- >您可以重新啓動使用廣播接收機您服務(當接收的來電,啓動完成,短信..使用這取決於您的要求)