Android应用跳转”微信公众号”的代码比较简介.
修改JumpToBizProfile类的参数即可, 注意的是profileType有两种类型, 一种是普通公众号, 一种是硬件公众号, 否则无法跳转.
代码
public void onWeixinClicked(View view) {
String url = "weixin/auth_device/";
SimpleOperation operation = new SimpleOperation(url, null,
new BlockOperationCallback<JSONObject>((G7Activity) getActivity()) {
@Override
public void operationExecutedSuccess(JSONObject jsonObject) {
JumpToBizProfile.Req req = new JumpToBizProfile.Req();
req.toUserName = "gh_xxx"; //公众号原始ID
req.extMsg = jsonObject.optString("ticket");
req.profileType = JumpToBizProfile.JUMP_TO_HARD_WARE_BIZ_PROFILE; // 硬件公众号
WeixinHelper.getWxApi(getActivity()).sendReq(req);
}
@Override
public void operationExecutedFailed(VolleyError volleyError) {
ToastHelper.getInstance().showToast(R.string.network_error);
}
}
);
sendBlockOperation(operation, R.string.network_loading);
}
版权声明:本文为博主原创文章,未经博主允许不得转载。
时间: 2024-11-02 10:43:27