quick cocos2dx 添加wap 跳转微信,支付宝

前端之家收集整理的这篇文章主要介绍了quick cocos2dx 添加wap 跳转微信,支付宝前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
修改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;
}
原文链接:https://www.f2er.com/cocos2dx/338675.html

猜你在找的Cocos2d-x相关文章