-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.java
More file actions
48 lines (37 loc) · 1.17 KB
/
App.java
File metadata and controls
48 lines (37 loc) · 1.17 KB
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
package com.partharaj;
import android.app.Application;
import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
import com.crashlytics.android.Crashlytics;
import io.fabric.sdk.android.Fabric;
import java.net.CookieHandler;
import java.net.CookieManager;
public class App extends Application {
public static final int PROJECT_CODE = 1;
public static String PROJECT_NAME = null;
private static App app;
private RequestQueue mRequestQueue;
public final String TAG = this.getClass().getSimpleName();
private static App context;
@Override
public void onCreate() {
super.onCreate();
Fabric.with(this, new Crashlytics());
context = this;
CookieHandler.setDefault(new CookieManager());
}
public static App getApp(){
return context;
}
private RequestQueue getRequestQueue() {
if (mRequestQueue == null) {
mRequestQueue = Volley.newRequestQueue(context);
}
return mRequestQueue;
}
public <T> void addToRequestQueue(Request<T> req) {
req.setTag(TAG);
getRequestQueue().add(req);
}
}