Created by cenxiaozhong on 2017/5/23. source code https://github.com/Justson/AgentWeb
| 14 | */ |
| 15 | |
| 16 | public class App extends Application { |
| 17 | |
| 18 | @Override |
| 19 | public void onCreate() { |
| 20 | super.onCreate(); |
| 21 | |
| 22 | /** |
| 23 | * 说明, WebView 初处初始化耗时 250ms 左右。 |
| 24 | * 提前初始化WebView ,好处可以提升页面初始化速度,减少白屏时间, |
| 25 | * 坏处,拖慢了App 冷启动速度,如果 WebView 配合 VasSonic 使用, |
| 26 | * 建议不要在此处提前初始化 WebView 。 |
| 27 | */ |
| 28 | // WebView mWebView=new WebView(new MutableContextWrapper(this)); |
| 29 | |
| 30 | // if (LeakCanary.isInAnalyzerProcess(this)) { |
| 31 | // // This process is dedicated to LeakCanary for heap analysis. |
| 32 | // // You should not init your app in this process. |
| 33 | // return; |
| 34 | // } |
| 35 | // LeakCanary.install(this); |
| 36 | // Normal app init code... |
| 37 | |
| 38 | //implementation 'com.github.Justson:dispatch-queue:v1.0.5' |
| 39 | GlobalQueue.getMainQueue().postRunnableInIdleRunning(new Runnable() { |
| 40 | @Override |
| 41 | public void run() { |
| 42 | try { |
| 43 | startService(new Intent(App.this, WebService.class)); |
| 44 | } catch (Throwable throwable) { |
| 45 | |
| 46 | } |
| 47 | } |
| 48 | }); |
| 49 | } |
| 50 | |
| 51 | public static Context mContext; |
| 52 | |
| 53 | @Override |
| 54 | protected void attachBaseContext(Context base) { |
| 55 | super.attachBaseContext(base); |
| 56 | mContext = base; |
| 57 | AgentWebCompat.setDataDirectorySuffix(base); |
| 58 | } |
| 59 | |
| 60 | |
| 61 | } |
nothing calls this directly
no outgoing calls
no test coverage detected