benCoding.Android.Tools
benCoding.Android.Tools copied to clipboard
Detecting of foreGround
Hi Ben,
I try to build an own module for implementing of
Ti.App.addEventListener("paused",function(){});
This is my code:
mTimer.scheduleAtFixedRate(new TimerTask() {
@Override
public void run() {
Boolean isInForeground = BensModule.isInForeground();
if (isInForeground != wasInForeGround) {
KrollDict dict = new KrollDict();
String key = (isInForeground == true) ? "resumed" : "paused";
app.fireAppEvent(key, dict);
wasInForeGround = isInForeground;
}
}
}, 0, 1000);
I use your method in tools ;-))
If the app goes to background, this will detected, but:
V8Object: (KrollRuntimeThread) [1,26193] Runtime disposed, cannot fire event 'paused'
Is it normal? Can I solve?
Code strong!
Rainer