Skip to content
This repository was archived by the owner on Nov 24, 2019. It is now read-only.
This repository was archived by the owner on Nov 24, 2019. It is now read-only.

Detecting of foreGround #19

Description

@AppWerft

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions