blob: e344343627503d9918f1358a2a8dcb01994f9a19 (
plain)
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
44
45
46
47
48
49
50
51
52
53
54
|
package com.mapbox.mapboxsdk.testapp;
import android.app.Application;
import android.os.StrictMode;
import com.mapbox.mapboxsdk.Mapbox;
import com.squareup.leakcanary.LeakCanary;
import timber.log.Timber;
import static timber.log.Timber.DebugTree;
/**
* Application class of the test application.
* <p>
* Initialises components as LeakCanary, Strictmode, Timber and Mapbox
* </p>
*/
public class MapboxApplication extends Application {
@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;
}
LeakCanary.install(this);
initializeLogger();
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectDiskReads()
.detectDiskWrites()
.detectNetwork()
.penaltyLog()
.build());
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
.detectLeakedSqlLiteObjects()
.penaltyLog()
.penaltyDeath()
.build());
Mapbox.getInstance(getApplicationContext(), getString(R.string.mapbox_access_token));
}
private void initializeLogger() {
if (BuildConfig.DEBUG) {
Timber.plant(new DebugTree());
}
}
}
|