代码加粗部分报错:The method createUnstrictWebApp(String, String, String, byte) from the type SDK is not visible
public void onCoreInitEnd(ICore coreHandler) {
// SDK.initSDK(coreHandler);
//注册扩展的Feature
//1,featureName 为特征名称
//2, className 为处理扩展Feature的接收类全名称
//3, content 为扩展Feature而创建的js代码,代码中必须使用 plus.bridge.execSync(featureName,actionName,[arguments])或plus.bridge.exec(featureName,actionName,[arguments])与native层进行数据交互
SDK.registerJsApi(featureName, className, content);
//创建默认webapp,赋值appid
String appid = "Test";
String appBasePath = BaseInfo.sBaseFsAppsPath;//获取runtime运行应用的文件系统根路径
String launchPage = "http://www.baidu.com";
launchPage = "file:///android_asset/apps/B8/index.html";
IApp app = SDK.createUnstrictWebApp(appid,appBasePath, launchPage,IApp.APP_RUNNING_MODE);//创建webapp句柄,指定首页面地址、运行模式为文件系统
app.addFeaturePermission(IFeature.F_RUNTIME);//添加runtime权限
app.addFeaturePermission(IFeature.F_UI);//添加ui权限
app.addFeaturePermission(featureName);
app.setConfigProperty(ConfigProperty.CONFIG_NAME, "测试webview方式集成sdk");
IWebview webview = SDK.obatinFirstPage(app);//获取webapp的首页面
final WebView web = webview.obtainWebview();//获取Webview
web.setOnKeyListener(new OnKeyListener() {//监听webview的页面的返回键
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if(web.canGoBack() && keyCode == KeyEvent.KEYCODE_BACK){
web.loadUrl("javascript:" + "var ret = window.plus.T.test();alert('结果为:'+ret);");
web.goBack();
return true;
}
return false;
}
});
SDK.attach(mRootView, app, webview);//附着webview到父容器mRootView
}

effiy
- 发布:2015-11-25 16:22
- 更新:2015-11-27 15:27
- 阅读:1631
The method createUnstrictWebApp(String, String, String, byte) from the type SDK is not visible
分类:5+ SDK
1 个回复
骁骑
这个接口已经废止了,文档已经做过修改,http://ask.dcloud.net.cn/article/81,或者参考SDK内HBuilder-Integrate工程代码
public static IApp startWebApp(Activity activity,String appBasePath,String startArgs,IWebviewStateListener listener,IOnCreateSplashView ocs)