2012-01-20 40 views
0

當設備進入睡眠狀態時,我的電暈應用程序不工作。沒有按鈕沒有響應繼續我的遊戲。 我使用以下代碼來跟蹤系統事件 。當屏幕關閉它打印applicationSuspend但屏幕上它永遠不會打印「applicationResume」 [使用過Android ADB日食顯示打印消息]從休眠狀態喚醒或暫停狀態後,我的應用程序無法工作

local function onSystemEvent(event) 

if(event.type == "applicationExit") then 
    print("applicationExit") 
    db:close() 
    elseif event.type == "applicationSuspend" then 

    print("applicationSuspend") 
    elseif event.type == "applicationResume" then 
     print("applicationResume") 
    elseif event.type == "applicationStart" then 
    print("applicationStart") 
end 
end 

任何解決方案之後?

+0

請包括代碼「周圍」,如果。例如,它在什麼功能 – kikito

+0

@kikito我將它包含在main.lua中...沒有特殊功能需要.. \ – vnshetty

+0

@kikito我編輯了我的任務 – vnshetty

回答

1

正如我肯定基基託指出的那樣;在我們可以提供更多幫助之前,我們可能需要擁有它的功能。

,據我所知,這個事件類型只能內部使用:

local function onSystemEvent(event) 

    print("System event name and type: " .. event.name, event.type) 
end 

Runtime:addEventListener("system", onSystemEvent) 

風格獨具特色的功能。

這是你使用它的方式嗎?

+0

是啊...即時通訊使用像這樣 – vnshetty

相關問題