OnApplicationFocus not called on Android

Hello,

I’m trying to understand how to build a small app on Android with Unity. Right now, I’m testing what happens when the app looses focus and regain it.

I’ve tried to just debug some text when the app lose/gain focus for now. It works on my Pc in the editor but not when I build on my Android (I use android logcat to see the debug on my pc).

Unsure if Pause/Focus was the one called for android I implemented both for a monobehavior object :

    void OnApplicationFocus(bool focus)
    {
        if (focus)
        {
            Debug.Log("F - Resume app");
        }
        else
            Debug.Log("F - Soft close app");
    }

    void OnApplicationPause(bool focus)
    {
        if (focus)
        {
            Debug.Log("P - Resume app");
        }
        else
            Debug.Log("P - Soft close app");
    }

Since the logs of the “focus” function print correctly on my PC and since other “debug lines” print correctly on my logcat, I really don’t see what I am missing here :slight_smile:

Thank you for your help

This is an known issue and has been fixed in 4.5.3. You can look at the issue here: