You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.3 KiB

//Copyright (c) 2017. 章钦豪. All rights reserved.
package com.monke.monkeybook;
import android.app.Application;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import com.monke.monkeybook.service.DownloadService;
import com.umeng.analytics.MobclickAgent;
public class MApplication extends Application {
private static MApplication instance;
@Override
public void onCreate() {
super.onCreate();
if (BuildConfig.IS_RELEASE) {
String channel = "debug";
try {
ApplicationInfo appInfo = getPackageManager()
.getApplicationInfo(getPackageName(),
PackageManager.GET_META_DATA);
channel = appInfo.metaData.getString("UMENG_CHANNEL_VALUE");
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
MobclickAgent.startWithConfigure(new MobclickAgent.UMAnalyticsConfig(this, getString(R.string.umeng_key), channel, MobclickAgent.EScenarioType.E_UM_NORMAL, true));
}
instance = this;
ProxyManager.initProxy();
startService(new Intent(this, DownloadService.class));
}
public static MApplication getInstance() {
return instance;
}
}