-
package com.zhanwei.lee.application; import android.app.Application; import android.content.Context; import android.content.res.Configuration; import android.util.Log; import com.sjl.foreground.Foreground; /** * Created by lizhanwei on 17/6/18. */ public class LeeApplication extends Application { private static Context mContext = null; private static final String TAG = "LeeApplication"; Foreground.Listener listener = new Foreground.Listener() { @Override public void onBecameForeground() { Log.d(TAG,"onBecameForground"); } @Override public void onBecameBackground() { Log.d(TAG,"onBecameBackground"); } }; @Override public void onCreate() { super.onCreate(); Foreground.init(this).addListener(listener); } @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); this.mContext = base; } @Override public void onTerminate() { super.onTerminate(); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); } @Override public void onLowMemory() { super.onLowMemory(); } @Override public void onTrimMemory(int level) { super.onTrimMemory(level); } public static Context getContext() { return mContext; } } package com.zhanwei.lee.applicati