The purpose of this code is because when you start an app, onResume is
called, even though you didn't pause anything.  You aren't receiving any
results, and you're not restoring any multi-tasking state.  There is no
state, because you just started the application.  If you were to not have
this, it's possible that there's not a view to request focus, and of
course, this would fail:

        // Force window to have focus, so application always

        // receive user input. Workaround for some devices (Samsung Galaxy
Note 3 at least)

        this.getWindow().getDecorView().requestFocus();

The state tracking is directly related to starting and stopping the app.

On Thu, Sep 18, 2014 at 1:08 PM, Archana Naik <naik.arch...@gmail.com>
wrote:

> Hi, Joe
>
> I have a question about a piece of code which has always been there in
> CordovaActivitie's onResume().
>
>  if (this.activityState == ACTIVITY_STARTING) {
>
>             this.activityState = ACTIVITY_RUNNING;
>
>             return;
>
>  }
>
>
> Do you know why we have this?
>
> Archana
>

Reply via email to