//U3d里面的代码
public void Share(string roomId = null)
{
Debug.Log ("------------------------进行微信好友分享-------------------------------------------");
string room = (roomId==null)?"":"房间号是:" + roomId;
AndroidJavaObject.Call("WeChatShare",
new object[] {
"http://www.daqingxinshikong.com/WebServer/?from=singlemessage&isappinstalled=1",
"一个很好玩的游戏",
"今天玩了一个很好玩的游戏3D游戏,你也来试试吧!哈哈!"+room
});
}
//Eclipes里面的代码
public void WeChatShare(String url, String title, String content)
{
WXWebpageObject webpage = new WXWebpageObject();
webpage.webpageUrl = url;
WXMediaMessage msg = new WXMediaMessage(webpage);
msg.title = title;
msg.description = content;
Bitmap thumb = BitmapFactory.decodeResource(getResources(), 2130837505);
msg.thumbData = ShareUtils.bmpToByteArray(thumb, true);
SendMessageToWX.Req req = new SendMessageToWX.Req();
req.transaction = buildTransaction("img");
req.message = msg;
req.scene = 0;
WXEntryActivity.api.sendReq(req);
}