Exemple #1
0
        private void goToShowMsg(ShowMessageFromWX.Req showReq)
        {
            WXMediaMessage    wxMsg = showReq.Message;
            WXAppExtendObject obj   = (WXAppExtendObject)wxMsg.MyMediaObject;

            // 组织一个待显示的消息内容
            StringBuffer msg = new StringBuffer();

            msg.Append("description: ");
            msg.Append(wxMsg.Description);
            msg.Append("\n");
            msg.Append("extInfo: ");
            msg.Append(obj.ExtInfo);
            msg.Append("\n");
            msg.Append("filePath: ");
            msg.Append(obj.FilePath);

            Intent intent = new Intent(this, typeof(ShowFromWXActivity));

            intent.PutExtra(Configuration.ShowMsgActivity.STitle, wxMsg.Title);
            intent.PutExtra(Configuration.ShowMsgActivity.SMessage, msg.ToString());
            //intent.PutExtra(Configuration.ShowMsgActivity.BAThumbData, wxMsg.ThumbData);
            StartActivity(intent);
            Finish();
        }
Exemple #2
0
 /**
  * 处理微信向第三方应用发起的消息
  * <p>
  * 此处用来接收从微信发送过来的消息,比方说本demo在wechatpage里面分享
  * 应用时可以不分享应用文件,而分享一段应用的自定义信息。接受方的微信
  * 客户端会通过这个方法,将这个信息发送回接收方手机上的本demo中,当作
  * 回调。
  * <p>
  * 本Demo只是将信息展示出来,但你可做点其他的事情,而不仅仅只是Toast
  */
 public void onShowMessageFromWXReq(WXMediaMessage msg)
 {
     if (msg != null && msg.Media != null &&
         (msg.Media is WXAppExtendObject))
     {
         WXAppExtendObject obj = (WXAppExtendObject)msg.Media;
         Toast.MakeText(this, obj.ExtInfo, ToastLength.Short).Show();
     }
 }