修改Cocos2dxWebView,在shouldOverrideUrlLoading 里添加 try { if(urlString.startsWith("weixin://") || urlString.startsWith("alipays://") || urlString.startsWith("mqqapi://") || urlString.startsWith("alipayqr://") //其他自定义的s
修改 Cocos2dxWebView,在shouldOverrideUrlLoading 里添加
try { if(urlString.startsWith("weixin://") || urlString.startsWith("alipays://") || urlString.startsWith("mqqapi://") || urlString.startsWith("alipayqr://") //其他自定义的scheme ) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(urlString)); Cocos2dxHelper.getActivity().startActivity(intent); return true; }else if (urlString.startsWith("intent://platformapi/startapp")) { Intent intent = Intent.parseUri(urlString, Intent.URI_INTENT_SCHEME); intent.addCategory("android.intent.category.BROWSABLE"); intent.setComponent(null); Cocos2dxHelper.getActivity().startActivity(intent); } } catch (Exception e) { //防止crash (如果手机上没有安装处理某个scheme开头的url的APP, 会导致crash) return false; }