android之微信分享音频
代码:
WXMusicObject muObj = new WXMusicObject(); muObj.musicUrl = "http://music.baidu.com/song/546920050?pst=sug"; WXMediaMessage msg = new WXMediaMessage(); msg.mediaObject = muObj; msg.title = "越过山丘"; msg.description = "演唱:123456"; Bitmap thumBitmap = BitmapFactory.decodeResource(getResources(), android.R.drawable.ic_input_add); msg.thumbData = bitmapToByteArray(thumBitmap, true); SendMessageToWX.Req req = new SendMessageToWX.Req(); req.transaction = buildTransction("music"); req.message = msg; req.scene = send_friend.isChecked() ? SendMessageToWX.Req.WXSceneTimeline : SendMessageToWX.Req.WXSceneSession; api.sendReq(req);