2 sinat 29351891 sinat_29351891 于 2015.07.24 11:20 提问

Android 微信分享成功后没有回调

public class WXPayEntryActivity extends Activity implements
IWXAPIEventHandler,OnClickListener {
private IWXAPI wx_api;
ImageView share_friend;
ImageView share_circle;
TextView cancel;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_fenxiang);
    share_friend = (ImageView) findViewById(R.id.share_friend);
    share_circle = (ImageView) findViewById(R.id.share_circle);
    cancel = (TextView) findViewById(R.id.quxiao);
    share_friend.setOnClickListener(this);
    share_circle.setOnClickListener(this);
    cancel.setOnClickListener(this);
    regToWx();
}

public void cancel(View view) {
    finish();
}

private void regToWx() {
    wx_api = WXAPIFactory.createWXAPI(this, "wx39f190a482377e7a");
    wx_api.registerApp("wx39f190a482377e7a");
    //wx_api.handleIntent(getIntent(), this);
}

@Override
protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    setIntent(intent);
    wx_api.handleIntent(intent, this);
}

public void weiChatShareFriend() {
    if (!wx_api.isWXAppInstalled()) {  
        Toast.makeText(WXPayEntryActivity.this, "您还未安装微信客户端",  
                Toast.LENGTH_SHORT).show();  
        return;  
    }  
    WXWebpageObject webpage = new WXWebpageObject();  
    webpage.webpageUrl = "http://tv.csu.edu.cn/index.php?s=/Home/Article/detail/id/1857.html";  
    WXMediaMessage msg = new WXMediaMessage(webpage);  

    msg.title = "来自XX的分享"; 
    msg.description = "分享 XXadAndroid版";  

    SendMessageToWX.Req req = new SendMessageToWX.Req();  
    req.transaction = String.valueOf(System.currentTimeMillis());  
    req.message = msg;  
    req.scene = SendMessageToWX.Req.WXSceneSession; 
    wx_api.sendReq(req);  

}

public void weiChatShareCricle(){
    if (!wx_api.isWXAppInstalled()) {  
        Toast.makeText(WXPayEntryActivity.this, "您还未安装微信客户端",  
                Toast.LENGTH_SHORT).show();  
        return;  
    }  
    WXWebpageObject webpage = new WXWebpageObject();  
    webpage.webpageUrl = "http://baidu.com";  
    WXMediaMessage msg = new WXMediaMessage(webpage);  

    msg.title = "来自XX的分享"; 
    msg.description = "分享 XXadAndroid版";  

    SendMessageToWX.Req req = new SendMessageToWX.Req();  
    req.transaction = String.valueOf(System.currentTimeMillis());  
    req.message = msg;  
    req.scene = SendMessageToWX.Req.WXSceneTimeline; 
    wx_api.sendReq(req);  
}


@Override
public void onClick(View arg0) {
    switch (arg0.getId()) {
    case R.id.share_friend:
        weiChatShareFriend();
        break;
    case R.id.share_circle:
        weiChatShareCricle();
        break;
    case R.id.quxiao:
        finish();
        break;
    default:
        break;
    }
}
@Override  
public void onReq(BaseReq arg0) {  

}  



@Override  
public void onResp(BaseResp resp) {  
    String result = "";  
    switch (resp.errCode) {  
    case BaseResp.ErrCode.ERR_OK:  
        result = "errcode_success";  
        break;  
    case BaseResp.ErrCode.ERR_USER_CANCEL:  
        result = "errcode_cancel";  
        break;  
    case BaseResp.ErrCode.ERR_AUTH_DENIED:  
        result = "errcode_deny";  
        break;  
    default:  
        result = "errcode_unknown";  
        break;  
    }  
     Toast.makeText(this, result, Toast.LENGTH_LONG).show();  
} 
回调机制已经写上去了,但分享成功后没有出现“分享成功”的回调提示

4个回答

CSDNXIAON
CSDNXIAON   2015.07.24 11:23
已采纳

微信分享成功后回调问题
----------------------同志你好,我是CSDN问答机器人小N,奉组织之命为你提供参考答案,编程尚未成功,同志仍需努力!

qq_30080223
qq_30080223   2015.07.24 11:36

不知道不知道不知道不知道不知道不知道

sina_2831808769
sina_2831808769   Rxr 2015.07.25 13:38

微信分享成功后回调问题

u014231084
u014231084   2016.06.29 17:20

这个问题解决了么?我也遇到了同样的问题

Csdn user default icon
上传中...
上传图片
插入图片