WMSApplication.java
1.23 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
49
50
51
52
53
54
package com.huaheng.wms;
import android.app.Application;
import android.database.sqlite.SQLiteDatabase;
import com.huaheng.wms.util.SoundUtils;
import com.huaheng.wms.wmsgreendao.DaoMaster;
import com.huaheng.wms.wmsgreendao.DaoSession;
public class WMSApplication extends Application {
private static String cookie;
// greenDao
private DaoMaster.DevOpenHelper mHelper;
private SQLiteDatabase db;
private DaoMaster mDaoMaster;
private DaoSession mDaoSession;
@Override
public void onCreate() {
super.onCreate();
SoundUtils.getInstance(this);
setupDataBase();
}
public static String getOkhttpCookie() {
return cookie;
}
public static void setOkhttpCookie(String result) {
cookie = result;
}
/**
* 初始化数据库
*/
private void setupDataBase() {
mHelper = new DaoMaster.DevOpenHelper(this, "WMSApplication", null);
db = mHelper.getWritableDatabase();
mDaoMaster = new DaoMaster(db);
mDaoSession = mDaoMaster.newSession();
WMSLog.d("setupDataBase");
}
public DaoSession getDaoSession() {
return mDaoSession;
}
public SQLiteDatabase getDb() {
return db;
}
}