@@ -0,0 +1,693 @@
+package com.itti7.itimeu;%0A%0Aimport android.app.Application;%0A%0A/**%0A * Created by Admin on 2017-09-03.%0A */%0A%0Apublic class Util extends Application %7B%0A    private static int stateCounter;%0A%0A    public void onCreate()%0A    %7B%0A        super.onCreate();%0A        stateCounter = 0;%0A    %7D%0A%0A    /**%0A     * @return true if application is on background%0A     * */%0A    public static boolean isApplicationOnBackground()%0A    %7B%0A        return stateCounter == 0;%0A    %7D%0A%0A    //to be called on each Activity onStart()%0A    public static void activityStarted()%0A    %7B%0A        stateCounter++;%0A    %7D%0A%0A    //to be called on each Activity onStop()%0A    public static void activityStopped()%0A    %7B%0A        stateCounter--;%0A    %7D%0A%7D%0A

add Util class for checking out if the application is running or on the back