package com.popo.module_search.mvp.app; import android.app.Application; import android.content.Context; import com.jess.arms.base.delegate.AppLifecycles; import com.jess.arms.utils.ArmsUtils; import com.popo.module_search.BuildConfig; import com.squareup.leakcanary.LeakCanary; import com.squareup.leakcanary.RefWatcher; /** * ================================================ * 展示 {@link AppLifecycles} 的用法 * <p> * Created by MVPArmsTemplate * <a href="mailto:[email protected]">Contact me</a> * <a href="https://github.com/JessYanCoding">Follow me</a> * ================================================ */ public class AppLifecyclesImpl implements AppLifecycles { @Override public void attachBaseContext(Context base) { } @Override public void onCreate(Application application) { if (LeakCanary.isInAnalyzerProcess(application)) { // This process is dedicated to LeakCanary for heap analysis. // You should not init your app in this process. return; } //使用 RetrofitUrlManager 切换 BaseUrl //RetrofitUrlManager.getInstance().putDomain(STEAM_DOMAIN_NAME, STEAM_DOMAIN); //当所有模块集成到宿主 App 时, 在 App 中已经执行了以下代码 if (BuildConfig.IS_BUILD_MODULE) { //leakCanary内存泄露检查 ArmsUtils.obtainAppComponentFromContext(application).extras().put(RefWatcher.class.getName(), BuildConfig.USE_CANARY ? LeakCanary.install(application) : RefWatcher.DISABLED); } } @Override public void onTerminate(Application application) { } }