Browse Source

第三方SDK延迟初始化

hy 3 years ago
parent
commit
5a729456b2

+ 2 - 1
app/build.gradle

@ -262,5 +262,6 @@ dependencies {
262 262
    implementation 'cn.jiguang.sdk:jpush:4.0.6'
263 263
    implementation 'cn.jiguang.sdk:jcore:2.8.2'
264 264
265
265
//    implementation 'com.github.huage2580:PermissionMonitor:1.0.1'
266
//    implementation "me.weishu:epic:1.0.0"
266 267
}

+ 3 - 5
app/src/main/java/com/electric/chargingpile/activity/PrivacyAgreementActivity.java

@ -37,7 +37,7 @@ public class PrivacyAgreementActivity extends Activity {
37 37
        setContentView(R.layout.activity_privacy_agreement);
38 38
        BarColorUtil.initStatusBarColor(PrivacyAgreementActivity.this);
39 39
        if (ProfileManager.getInstance().getPrivacyAgreement(this)) {
40
            Application.initMobSDK();
40
            MainApplication.Application.initSDK();
41 41
            Log.e("TAG_HYC", "onCreate:  getPrivacyAgreement" );
42 42
            startActivity(new Intent(PrivacyAgreementActivity.this, WelcomeActivity.class));
43 43
            finish();
@ -105,7 +105,7 @@ public class PrivacyAgreementActivity extends Activity {
105 105
        agreement_btn.setOnClickListener(new View.OnClickListener() {
106 106
            @Override
107 107
            public void onClick(View v) {
108
                Application.initMobSDK();
108
                MainApplication.Application.initSDK();
109 109
                startActivity(new Intent(PrivacyAgreementActivity.this, WelcomeActivity.class));
110 110
                finish();
111 111
            }
@ -134,7 +134,5 @@ public class PrivacyAgreementActivity extends Activity {
134 134
        });
135 135
    }
136 136
137
    private void initMobSDK() {
138
        MobSDK.init(MainApplication.context);
139
    }
137
140 138
}

+ 9 - 5
app/src/main/java/com/electric/chargingpile/application/MainApplication.java

@ -161,17 +161,14 @@ public class MainApplication extends MultiDexApplication {
161 161
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
162 162
            builder.detectFileUriExposure();
163 163
        }
164

165
//        MobSDK.init(this);
166

164
//        PermissionMonitor.start(false);
167 165
        instances = this;
168 166
        setDatabase();
169 167

170 168
        Utils.init(this);
171 169
        LogUtils.getConfig().setLogSwitch(true);
172 170

173
        CrashReport.initCrashReport(getApplicationContext(), "900010422", BuildConfig.DEBUG);
174
        CrashReport.setAppChannel(getApplicationContext(), BuildConfig.FLAVOR);
171

175 172
        initImageLoader(getApplicationContext());
176 173

177 174
        try {
@ -391,6 +388,13 @@ public class MainApplication extends MultiDexApplication {
391 388
        this.pushID = pushID;
392 389
        ProfileManager.getInstance().setPushID(getApplicationContext(), pushID);
393 390
    }
391

392
    public static void initSDK() {
393
        MobSDK.init(MainApplication.context);
394
        MobSDK.submitPolicyGrantResult(true,null);
395
        CrashReport.initCrashReport(MainApplication.context, "900010422", BuildConfig.DEBUG);
396
        CrashReport.setAppChannel(MainApplication.context, BuildConfig.FLAVOR);
397
    }
394 398
}
395 399

396 400


+ 2 - 1
gradle.properties

@ -2,4 +2,5 @@ org.gradle.jvmargs=-Xmx8192m -XX:MaxPermSize=1024m -XX:+HeapDumpOnOutOfMemoryErr
2 2
3 3
android.injected.testOnly=false
4 4
android.useAndroidX=true
5
android.enableJetifier=true
5
android.enableJetifier=true
6
MobSDK.spEdition=FP