This article is mainly to share with you one-time subscription message Access problem resolution, the environment has been connected to send a one-time subscription message authorization:
Final Iwxapi API = Wxapifactory.createwxapi (Settingactivity.this, Response.getappid ()); Register the APP with Api.registerapp (serverurls.weixin_app_id); LOG.I ("20180228", "come to send request with subscribemessage ...."); Subscribemessage.req Req = new Subscribemessage.req (); Req.templateid = Response.gettemplateid (); Req.scene = 889;//req.reserved = response.getreserved (); LOG.I ("20180228", "Req.appid:" +response.getappid ()); LOG.I ("20180228", "Req.templateid:" +req.templateid);//LOG.I ("20180228", "Req.scene:" +req.scene);// LOG.I ("20180228", "req.reserved:" +req.reserved); LOG.I ("20180228", "before send request:" +req.tostring ()); Boolean sendresult = Api.sendreq (req); LOG.I ("20180228", "After send request:" +sendresult); Toastutils.show (Settingactivity.this, "Send Request End");
The
makes simple processing in callbacks in the authorization page:
@Override public void Onresp (Baseresp resp) {log.i ("20180228", "Here come to the RESP with WeChat request:" +re Sp.tostring ()); LOG.I ("20180228", "Here come to the RESP with WeChat Errcode:" +resp.errcode); LOG.I ("20180228", "Here come to the RESP with WeChat errstr:" +resp.errstr); LOG.I ("20180228", "Here come to the RESP with WeChat openId:" +resp.openid); LOG.I ("20180228", "Here come to the RESP with WeChat type:" +resp.gettype ()); Toastutils.show (This, "OpenId:" +resp.openid); if (resp.gettype () = = Constantsapi.command_subscribe_message) {log.i ("20180305", "Here come to Resp method Succe Ssful ... "); }//if (resp.gettype () = = Constantsapi.command_sendauth && Resp.errcode = = BaseResp.ErrCode.ERR_OK) {// Toastutils.show (This, "Request auth here ...");//String openId = resp.openid;//int Errcode = resp.errcode;//String errstring = resp.errstr;//// New Usermanager (this). Bidnwxrss (OpenId, New simplecallback<apiresponse> () {//@Override// public void onsuccess (Apiresponse response) {//Toastutils.show (Wxentryactivity.this, "bind succeeded!"); /finish ();//}//});/} finish (); }
To display in an open debug print:
03-05 17:46:00.967 10706-10706/com.xxx i/micromsg.sdk.wxapiimplv10:handleintent, cmd = 403-05 17:46:00.967 10706-10706 /com.xxx i/micromsg.sdk.wxmediamessage:patholdtonew, OldPath = com.tencent.mm.sdk.openapi.wxappextendobject03-05 17:46:00.967 10706-10706/com.xxx i/micromsg.sdk.wxapiimplv10:handlewxinternalresptype, extInfo = Wx_internal_ Resptype=subscribemessage&openid=oerx_wojrjvv8nzuujhckje5pzwu&template_id=h0txdbxs_ Ea5bvofycfbupzl3hrglwhxjivbeyhsnxq&action=confirm&reserved=null&scene=88903-05 17:46:00.967 10706-10706/com.xxx I/micromsg.sdk.wxapiimplv10:handlewxinternalresptype, Resptype = null03-05 17:46:00.967 10706-10706/com.xxx E/micromsg.sdk.wxapiimplv10:handlewxinternalresptype fail, resptype is null
Handleintent (), the return is false, and cannot call the Onresp method, the reason is because the above resptype = null, but the above found that Extinfo is data, and can be seen Wx_internal_ Resptype=subscribemessage.
View Wxapiimplv10.class here, some of the code is as follows:
That is, this side of the resptype=subscribemessage, but the above parsing out into null, where the key code is:
Then understand that this side of the Extinfo string at the beginning of a "?", so the extinfo parsed into a URI, the specified "Wx_internal_resptype" attribute is not found. So the page will be stuck in the wxentryactivity page not to do the next step, this side hope that the development team can deal with early!