<喎?http: www.bkjia.com kf ware vc " target="_blank" class="keylink"> VcD4KPHA + signature + cve-vcd4kpha + signature/Signature vcD4KPHA + PGJyPgo8L3A + signature/Signature + signature + cve-vcd4kpha + tdrI/Signature + Signature 9Pr1Nq/release + PC9wPgo8cHJlIGNsYXNzPQ = "brush: java; "> IWXAPI api = wxapifacloud. createWXAPI (context, APP_ID, false); api. registerApp (APP_ID); WXWebpageObject webpage = new WXWebpageObject (); webpage. webpageUrl = "http://www.xxxx.com/wap/showShare/;WXMediaMessage msg = new WXMediaMessage (webpage); msg. title = "My offer"; msg. description = "I want to share"; try {Bitmap bmp = BitmapFactory. decodeResource (getResources (), R. drawable. send_img); Bitmap thumbBmp = Bitmap. createScaledBitmap (bmp, 150,150, true); bmp. recycle (); msg. setThumbImage (thumbBmp);} catch (Exception e) {e. printStackTrace ();} SendMessageToWX. req req = new SendMessageToWX. req (); req. transaction = String. valueOf (System. currentTimeMillis (); req. message = msg; req. scene = SendMessageToWX. req. WXSceneTimeline; api. sendReq (req );
If everything goes well, you will see a similar image at the beginning of the article.
Click Cancel or share.
Step 4: add the prompt callback page.
(1) create a new package
The rule is your package name plus wxapi [for example, com. xxx. wxapi]
(2) Add a class in the newly created package, WXEntryActivity. java. The name must be consistent, which is specified by the open platform.
package com.xxx.wxapi;import android.app.Activity;import android.os.Bundle;import android.widget.Toast;import com.lbt.hairdesigner.R;import com.lbt.hairdesigner.utils.MySetting;import com.tencent.mm.sdk.openapi.BaseReq;import com.tencent.mm.sdk.openapi.BaseResp;import com.tencent.mm.sdk.openapi.IWXAPI;import com.tencent.mm.sdk.openapi.IWXAPIEventHandler;import com.tencent.mm.sdk.openapi.WXAPIFactory;public class WXEntryActivity extends Activity implements IWXAPIEventHandler{private IWXAPI api;@Overrideprotected void onCreate(Bundle savedInstanceState){super.onCreate(savedInstanceState);api = WXAPIFactory.createWXAPI(this, APP_ID, false);api.registerApp(APP_ID);api.handleIntent(getIntent(), this);}@Overridepublic void onReq(BaseReq req){}@Overridepublic void onResp(BaseResp resp){int result = 0;switch (resp.errCode){case BaseResp.ErrCode.ERR_OK:result = R.string.errcode_success;break;case BaseResp.ErrCode.ERR_USER_CANCEL:result = R.string.errcode_cancel;break;case BaseResp.ErrCode.ERR_AUTH_DENIED:result = R.string.errcode_deny;break;default:result = R.string.errcode_unknown;break;}Toast.makeText(this, result, Toast.LENGTH_LONG).show();finish();overridePendingTransition(R.anim.change_in, R.anim.change_out);}}
(3) add some characters to string. xml
Sent successfully
Cancel sending
The message is rejected.
Send back
(4) Attach change_in.xml and change_out.xml
Finally, no matter where you call the third-step sharing, a callback prompt will be displayed.
============ THE ==== END ====================================