api 'com.tencent.mm.opensdk:wechat-sdk-android-without-mta:+'
private void regToWx() {
api = WXAPIFactory.createWXAPI(this, Config.appKey, true);
api.registerApp(Config.appKey);
registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
api.registerApp(Config.appKey);
}
}, new IntentFilter(ConstantsAPI.ACTION_REFRESH_WXAPP));
}
public static void share(Task task, Context context) {
Log.d(Config.TAG, "start share");
IWXAPI api = MyApplication.getIWXAPI();
WXWebpageObject webpage = new WXWebpageObject();
webpage.webpageUrl = task.getUrl();
WXMediaMessage msg = new WXMediaMessage(webpage);
msg.title = task.getContext();
msg.description = task.getContext();
msg.thumbData = getImgByte(task.getImg(), context);
SendMessageToWX.Req req = new SendMessageToWX.Req();
req.transaction = buildTransaction("webpage");
req.message = msg;
req.scene = SendMessageToWX.Req.WXSceneTimeline;
api.sendReq(req);
Log.d(Config.TAG, "send share msg");
}
截图看下具体表现?