-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathMyApp.java
43 lines (32 loc) · 1.02 KB
/
MyApp.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package com.morihacky.android.rxjava;
import android.support.multidex.MultiDexApplication;
import com.morihacky.android.rxjava.volley.MyVolley;
import com.squareup.leakcanary.LeakCanary;
import com.squareup.leakcanary.RefWatcher;
import timber.log.Timber;
public class MyApp extends MultiDexApplication {
private static MyApp _instance;
private RefWatcher _refWatcher;
public static MyApp get() {
return _instance;
}
public static RefWatcher getRefWatcher() {
return MyApp.get()._refWatcher;
}
@Override
public void onCreate() {
super.onCreate();
if (LeakCanary.isInAnalyzerProcess(this)) {
// This process is dedicated to LeakCanary for heap analysis.
// You should not init your app in this process.
return;
}
_instance = (MyApp) getApplicationContext();
_refWatcher = LeakCanary.install(this);
// for better RxJava debugging
//RxJavaHooks.enableAssemblyTracking();
// Initialize Volley
MyVolley.init(this);
Timber.plant(new Timber.DebugTree());
}
}