本文整理汇总了Java中com.tencent.mm.sdk.openapi.WXMusicObject类的典型用法代码示例。如果您正苦于以下问题:Java WXMusicObject类的具体用法?Java WXMusicObject怎么用?Java WXMusicObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WXMusicObject类属于com.tencent.mm.sdk.openapi包,在下文中一共展示了WXMusicObject类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shareMusic
import com.tencent.mm.sdk.openapi.WXMusicObject; //导入依赖的package包/类
private void shareMusic(int shareType, ShareContent shareContent) {
WXMusicObject music = new WXMusicObject();
//Str1+"#wechat_music_url="+str2 ;str1是网页地址,str2是音乐地址。
music.musicUrl =shareContent.getURL()+ "#wechat_music_url="+shareContent.getMusicUrl();
WXMediaMessage msg = new WXMediaMessage(music);
msg.title = shareContent.getTitle();
msg.description = shareContent.getContent();
SendMessageToWX.Req req = new SendMessageToWX.Req();
req.transaction = ShareUtil.buildTransaction("music");
req.message = msg;
req.scene = shareType;
sendShare(shareContent.getImageUrl(), req);
}
示例2: sendMusicUrlBmp
import com.tencent.mm.sdk.openapi.WXMusicObject; //导入依赖的package包/类
/**
* @param title
* @param desc
* @param musicUrl
* @param bmp
* @param isTimeline
* @return
*/
public boolean sendMusicUrlBmp(String title, String desc, String musicUrl, Bitmap bmp, boolean isTimeline) {
WXMediaMessage msg = createMediaMsg(title, desc);
WXMusicObject musicObj = new WXMusicObject();
musicObj.musicUrl = musicUrl;
msg.mediaObject = musicObj;
if (bmp != null && !bmp.isRecycled()) {
setThumbBmpDataToMsg(msg, bmp);
}
return sendReq(msg, isTimeline);
}
示例3: shareMusic
import com.tencent.mm.sdk.openapi.WXMusicObject; //导入依赖的package包/类
/**
* 分享音乐
*/
public void shareMusic(Context context, WeChatSKShareContent content, boolean isToFriend) {
WXMusicObject musicObject = new WXMusicObject();
musicObject.musicUrl = content.musicUrl;
send(context, content, isToFriend, musicObject, "music");
}