sinat_29351891 2015-07-24 03:20 采纳率: 100%
浏览 4911

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();  
} 
回调机制已经写上去了,但分享成功后没有出现“分享成功”的回调提示
  • 写回答

3条回答 默认 最新

  • qq_30080223 2015-07-24 03:36
    关注

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

    评论

报告相同问题?

悬赏问题

  • ¥120 目前wxid加好友的渠道都被和谐了吗
  • ¥15 关于#网络#的问题:网络是从楼上引一根网线下来,接了2台傻瓜交换机,也更换了ip还是不行
  • ¥15 资源泄露软件闪退怎么解决?
  • ¥15 CCF-CSP 2023 第三题 解压缩(50%)
  • ¥30 comfyui openpose报错
  • ¥20 Wpf Datarid单元格闪烁效果的实现
  • ¥15 图像分割、图像边缘提取
  • ¥15 sqlserver执行存储过程报错
  • ¥100 nuxt、uniapp、ruoyi-vue 相关发布问题
  • ¥15 浮窗和全屏应用同时存在,全屏应用输入法无法弹出