本文整理汇总了Java中com.tencent.smtt.sdk.QbSdk.initX5Environment方法的典型用法代码示例。如果您正苦于以下问题:Java QbSdk.initX5Environment方法的具体用法?Java QbSdk.initX5Environment怎么用?Java QbSdk.initX5Environment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.tencent.smtt.sdk.QbSdk
的用法示例。
在下文中一共展示了QbSdk.initX5Environment方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import com.tencent.smtt.sdk.QbSdk; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
WindowManager.LayoutParams localLayoutParams = getWindow().getAttributes();
localLayoutParams.flags = (WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | localLayoutParams.flags);
}
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
QbSdk.initX5Environment(this, null);
init();
setViewPager();
setNavigationView();
setBackGround();
setReceiver();
}
示例2: initApplication
import com.tencent.smtt.sdk.QbSdk; //导入方法依赖的package包/类
private void initApplication() {
//初始化日志
Logger.init(getPackageName()).hideThreadInfo();
//初始化错误收集
// CrashHandler.init(new CrashHandler(getApplicationContext()));
initBugly();
//初始化内存泄漏检测
LeakCanary.install(App.getInstance());
//初始化过度绘制检测
BlockCanary.install(getApplicationContext(), new AppBlockCanaryContext()).start();
//初始化tbs x5 webview
QbSdk.allowThirdPartyAppDownload(true);
QbSdk.initX5Environment(getApplicationContext(), QbSdk.WebviewInitType.FIRSTUSE_AND_PRELOAD, new QbSdk.PreInitCallback() {
@Override
public void onCoreInitFinished() {
}
@Override
public void onViewInitFinished(boolean b) {
}
});
}
示例3: initHybrid
import com.tencent.smtt.sdk.QbSdk; //导入方法依赖的package包/类
private void initHybrid() {
// 初始化WebView池
WebViewPool.getInstance().initWebViewPool(getApplicationContext());
// 初始化x5内核
QbSdk.initX5Environment(getApplicationContext(), new QbSdk.PreInitCallback() {
@Override
public void onCoreInitFinished() {
Log.i("initX5Environment", "x5 core init finished.");
}
@Override
public void onViewInitFinished(boolean b) {
Log.i("initX5Environment", "x5 view has " + (b ? "" : "not") + " finished.");
}
});
}
示例4: onCreate
import com.tencent.smtt.sdk.QbSdk; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
QbSdk.PreInitCallback cb = new QbSdk.PreInitCallback() {
@Override
public void onViewInitFinished(boolean arg0) {
// TODO Auto-generated method stub
//x5內核初始化完成的回调,为true表示x5内核加载成功,否则表示x5内核加载失败,会自动切换到系统内核。
Log.d("app", " onViewInitFinished is " + arg0);
}
@Override
public void onCoreInitFinished() {
// TODO Auto-generated method stub
}
};
//x5内核初始化接口
QbSdk.initX5Environment(getApplicationContext(), cb);
changeLanguage(this);
}
示例5: initX5Environment
import com.tencent.smtt.sdk.QbSdk; //导入方法依赖的package包/类
/**
* x5内核初始化接口
*/
private void initX5Environment() {
//搜集本地tbs内核信息并上报服务器,服务器返回结果决定使用哪个内核。
QbSdk.PreInitCallback cb = new QbSdk.PreInitCallback() {
@Override
public void onViewInitFinished(boolean arg0) {
//x5內核初始化完成的回调,为true表示x5内核加载成功,否则表示x5内核加载失败,会自动切换到系统内核。
LogUtils.e("myApplication", " onViewInitFinished is " + arg0);
}
@Override
public void onCoreInitFinished() {
}
};
//x5内核初始化接口
QbSdk.initX5Environment(getApplicationContext(), cb);
}
示例6: onCreate
import com.tencent.smtt.sdk.QbSdk; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
QbSdk.initX5Environment(this, new QbSdk.PreInitCallback() {
@Override
public void onCoreInitFinished() {
Log.d("MainApplication", "x5 core load success");
Toast.makeText(MyApplication.this, "x5 core load success", Toast.LENGTH_SHORT).show();
}
@Override
public void onViewInitFinished(boolean b) {
}
});
}
示例7: onCreate
import com.tencent.smtt.sdk.QbSdk; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
QbSdk.PreInitCallback cb = new QbSdk.PreInitCallback() {
@Override
public void onViewInitFinished(boolean b) {
//x5內核初始化完成的回调,为true表示x5内核加载成功,否则表示x5内核加载失败,会自动切换到系统内核。
Log.d("app", " onViewInitFinished is " + b);
}
@Override
public void onCoreInitFinished() {
// TODO Auto-generated method stub
}
};
//x5内核初始化接口
QbSdk.initX5Environment(getApplicationContext(), cb);
}
示例8: X5WebViewEngine
import com.tencent.smtt.sdk.QbSdk; //导入方法依赖的package包/类
/** Used when created via reflection. */
public X5WebViewEngine(Context context, CordovaPreferences preferences) {
if(!isInit)
{
QbSdk.PreInitCallback cb = new QbSdk.PreInitCallback() {
@Override
public void onViewInitFinished(boolean arg0) {
}
@Override
public void onCoreInitFinished() {
isInit = true;
}
};
QbSdk.initX5Environment(context, cb);
}
this.preferences = preferences;
this.webView = new X5WebView(context);
cookieManager = new X5CookieManager(webView);
}
示例9: initQbSdk
import com.tencent.smtt.sdk.QbSdk; //导入方法依赖的package包/类
private void initQbSdk() {
try {
QbSdk.allowThirdPartyAppDownload(true);
QbSdk.initX5Environment(getApplicationContext(), QbSdk.WebviewInitType.FIRSTUSE_AND_PRELOAD, new QbSdk.PreInitCallback() {
@Override
public void onCoreInitFinished() {
}
@Override
public void onViewInitFinished(boolean b) {
}
});
} catch (Exception e) {
e.printStackTrace();
}
}
示例10: onCreate
import com.tencent.smtt.sdk.QbSdk; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
//增加这句话
QbSdk.initX5Environment(this,null);
ExceptionHandler.getInstance().initConfig(this);
}
示例11: onCreate
import com.tencent.smtt.sdk.QbSdk; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
if (LeakCanary.isInAnalyzerProcess(this)) {
// This process is dedicated to LeakCanary for heap analysis.
// You should not init your app in this process.
return;
}
LeakCanary.install(this);
// Normal app init code...
QbSdk.PreInitCallback cb = new QbSdk.PreInitCallback() {
@Override
public void onViewInitFinished(boolean arg0) {
// TODO Auto-generated method stub
//x5內核初始化完成的回调,为true表示x5内核加载成功,否则表示x5内核加载失败,会自动切换到系统内核。
Log.d("app", " onViewInitFinished is " + arg0);
}
@Override
public void onCoreInitFinished() {
// TODO Auto-generated method stub
}
};
//x5内核初始化接口
QbSdk.initX5Environment(getApplicationContext(), cb);
}
示例12: onCreate
import com.tencent.smtt.sdk.QbSdk; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
instance = this;
//初始化日志
Logger.init(getPackageName()).hideThreadInfo();
//初始化tbs x5 webview
QbSdk.allowThirdPartyAppDownload(true);
QbSdk.initX5Environment(getApplicationContext(), QbSdk.WebviewInitType.FIRSTUSE_AND_PRELOAD, null);
}
示例13: initTencentX5
import com.tencent.smtt.sdk.QbSdk; //导入方法依赖的package包/类
private static void initTencentX5(final Context context) {
int tbsVersion = 0;
boolean noTencentX5 = false;
try {
String[] lists = context.getAssets().list("widget");
for (int i = 0; i < lists.length; i++) {
if (lists[i].equalsIgnoreCase("notencentx5")) {
noTencentX5 = true;
}
}
} catch (IOException e) {
e.printStackTrace();
}
//初始化X5引擎SDK
tbsVersion = QbSdk.getTbsVersion(context);
if (noTencentX5 || (tbsVersion > 0 && tbsVersion < 30000)) {
BDebug.i("AppCanTBS", "QbSdk.forceSysWebView()");
QbSdk.forceSysWebView();
}
if(!QbSdk.isTbsCoreInited() && (tbsVersion == 0 || tbsVersion >= 30000) && !noTencentX5){
final long timerCounter = System.currentTimeMillis();
// 如果手机没有可以共享的X5内核,会先下载并安装,首次启动不会使用X5,再次启动才会使用X5;
// 如果手机有可以共享的X5内核,但未安装,会先安装,首次启动不会使用X5,再次启动才会使用X5;
// 如果手机有可以共享的X5内核,已经安装,首次启动会使用X5;
QbSdk.initX5Environment(context, new QbSdk.PreInitCallback(){
@Override
public void onViewInitFinished(boolean success) {
CookieSyncManager.createInstance(context);
CookieManager.getInstance().setAcceptCookie(true);
CookieManager.getInstance().removeSessionCookie();
CookieManager.getInstance().removeExpiredCookie();
float deltaTime = (System.currentTimeMillis() - timerCounter);
BDebug.i("AppCanTBS", "success " + success + " x5初始化使用了" + deltaTime + "毫秒");
}
@Override
public void onCoreInitFinished() {
BDebug.i("AppCanTBS", "onX5CoreInitFinished!!!!");
}
});
}
}
示例14: initX5Environment
import com.tencent.smtt.sdk.QbSdk; //导入方法依赖的package包/类
/**
* 预加载腾讯X5内核,在Application的onCreate方法中调用。
* 如果用到腾讯X5服务,必须调用此方法。
*
* @param appContext
* @param callback
*/
public static void initX5Environment(Context appContext, @Nullable QbSdk.PreInitCallback callback) {
QbSdk.initX5Environment(appContext, callback);
}