2012-01-20 43 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

相关问题