| | |
| | | import android.os.Message; |
| | | import android.telephony.TelephonyManager; |
| | | import android.util.Log; |
| | | import android.webkit.WebView; |
| | | import android.widget.Toast; |
| | | |
| | | import com.alibaba.baichuan.android.trade.AlibcTradeSDK; |
| | |
| | | } catch (Exception e) { |
| | | } |
| | | |
| | | //解决错误:Using WebView from more than one process at once with the same data directory is not supported |
| | | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { |
| | | String processName = getProcessName(application); |
| | | String packageName = application.getPackageName(); |
| | | if (!packageName.equals(processName)) { |
| | | WebView.setDataDirectorySuffix(processName); |
| | | } |
| | | } |
| | | |
| | | //友盟初始化 |
| | | String description = ManifestDataUtil.getAppMetaData(application, "UMENG_CHANNEL"); |
| | | try { |
| | |
| | | initX5(application); |
| | | initNovel(application); |
| | | initDPSDK(application); |
| | | } |
| | | |
| | | private static String getProcessName(Context context) { |
| | | if (context == null) return null; |
| | | ActivityManager manager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); |
| | | for (ActivityManager.RunningAppProcessInfo processInfo : manager.getRunningAppProcesses()) { |
| | | if (processInfo.pid == android.os.Process.myPid()) { |
| | | return processInfo.processName; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | if (!dpSDKIninted) { |
| | | DPSdkConfig.Builder configBuilder = new DPSdkConfig.Builder() |
| | | .debug(true) |
| | | .debug(false) |
| | | .preloadDraw(true) |
| | | .needInitAppLog(false) |
| | | .setIsAndroidx(true) |