private final static String H5 = "H5";
private final static String TAOBAO = "taobao";
private final static String TMALL = "tmall";
private final static String AUTO = "auto";
private static void showDetailPage(Activity activity, String id, String type) {
AlibcShowParams alibcShowParams;
switch (type) {
case H5:
alibcShowParams = new AlibcShowParams(OpenType.H5, false);
break;
case TAOBAO:
alibcShowParams = new AlibcShowParams(OpenType.Native, false);
alibcShowParams.setClientType("taobao_scheme");
break;
case TMALL:
alibcShowParams = new AlibcShowParams(OpenType.Native, false);
alibcShowParams.setClientType("tmall_scheme");
break;
case AUTO:
alibcShowParams = new AlibcShowParams(OpenType.Auto, false);
break;
default:
alibcShowParams = new AlibcShowParams(OpenType.Auto, false);
break;
}
AlibcBasePage alibcBasePage = new AlibcDetailPage(id);
HashMap<String, String> exParams = new HashMap<>();
exParams.put(AlibcConstants.ISV_CODE, "appisvcode");
AlibcTaokeParams alibcTaokeParams = new AlibcTaokeParams();
alibcTaokeParams.adzoneid = "33333";
alibcTaokeParams.pid = "mm_11111_22222_33333";
alibcTaokeParams.subPid = "mm_11111_22222_33333";
alibcTaokeParams.extraParams = new HashMap<>();
alibcTaokeParams.extraParams.put("taokeAppkey", "xxxxxxx");
AlibcTrade.show(activity, alibcBasePage, alibcShowParams, alibcTaokeParams, exParams, new AlibcTradeCallback() {
@Override
public void onTradeSuccess(AlibcTradeResult alibcTradeResult) {
}
@Override
public void onFailure(int i, String s) {
}
});
}
* 跳淘宝详情
*/
public static void showTaobaoDetail(Activity activity, String id) {
if (Tools.isApplicationAvilible(activity, "com.taobao.taobao")) {
showDetailPage(activity, id, TAOBAO);
} else {
showDetailPage(activity, id, AUTO);
}
}
* 跳天猫详情
*/
public static void showTmallDetail(Activity activity, String id) {
if (Tools.isApplicationAvilible(activity, "com.tmall.wireless")) {
showDetailPage(activity, id, TMALL);
} else {
showDetailPage(activity, id, AUTO);
}
}