程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> android-Android 微信分享成功後沒有回調

android-Android 微信分享成功後沒有回調

編輯:編程綜合問答
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();  
} 
回調機制已經寫上去了,但分享成功後沒有出現“分享成功”的回調提示

最佳回答:


微信分享成功後回調問題
----------------------同志你好,我是CSDN問答機器人小N,奉組織之命為你提供參考答案,編程尚未成功,同志仍需努力!

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved