接入微信的登录、支付、和分享,使用的wechat-sdk-android-without-mta:5.5.8这个SDK。
Android端cocos接入。登录和支付已经正常。
但只有分享功能可以跳到选择分享给谁的界面,但点击分享给谁都没反应。
private void wxShare(final String params) {
Log.e(TAG, "ShareWX 333");
try {
JSONObject json = new JSONObject(params);
if(null == json) {
Log.e(TAG, "ShareWX 444");
Toast.makeText(this, "WWWWWWQQQQQQQQ", Toast.LENGTH_SHORT).show();
return;
}
WXWebpageObject webpage = new WXWebpageObject();
webpage.webpageUrl = "http://www.qq.com";
Log.e(TAG, "ShareWX 555");
WXMediaMessage msg = new WXMediaMessage(webpage);
msg.title = "WebPage Title Very Long";
msg.description = "WebPage Description Very Long";
Log.e(TAG, "ShareWX 666");
// int thumbSize = 150;
// Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.send_img);
// Bitmap thumbBmp = Bitmap.createScaledBitmap(bmp, thumbSize, thumbSize, true);
// bmp.recycle();
// msg.thumbData = Util.bmpToByteArray(thumbBmp, true);
msg.thumbData = null;
SendMessageToWX.Req req = new SendMessageToWX.Req();
req.transaction = buildTransaction("webpage");
req.message = msg;
String scene = SendMessageToWX.Req.WXSceneSession;
Log.e(TAG, "ShareWX 777");
api.sendReq(req);
Log.e(TAG, "ShareWX 888");
} catch (JSONException e) {
Log.e(TAG, e.getMessage());
Toast.makeText(this, "分享数据异常: " + e, Toast.LENGTH_SHORT).show();
}
}
分享代码附近的日志:
03-04 12:35:54.720 D/JniHelper(24777): JniHelper::getJavaVM(), pthread_self() = -845010576
03-04 12:35:54.721 E/MicroMsg.WXEntryActivity(24777): ShareWX 1
03-04 12:35:54.721 E/MicroMsg.WXEntryActivity(24777): ShareWX 2
03-04 12:35:54.721 E/MicroMsg.WXEntryActivity(24777): ShareWX 333
03-04 12:35:54.721 E/MicroMsg.WXEntryActivity(24777): ShareWX 555
03-04 12:35:54.721 E/MicroMsg.WXEntryActivity(24777): ShareWX 666
03-04 12:35:54.721 E/MicroMsg.WXEntryActivity(24777): ShareWX 777
03-04 12:35:54.721 D/MicroMsg.SDK.WXMsgImplComm(24777): ignore wechat app signature validation
03-04 12:35:54.721 I/MicroMsg.SDK.WXApiImplV10(24777): sendReq, req type = 2
03-04 12:35:54.734 D/ (24777): addLayerName, tid:24799
03-04 12:35:54.745 I/AppFASManager( 1987): set fas when standby protected app list changed :
03-04 12:35:54.750 D/ (24777): addLayerName, tid:24799
03-04 12:35:54.773 V/ActivityManager( 1174): Successfully start provider ContentProviderRecord{fc50043 u0 com.tencent.mm/.plugin.base.stub.WXCommProvider} launchingApp=null caller pid= 24777
03-04 12:35:54.774 I/NetworkPolicy( 1174): updateRuleForRestrictBackgroundUL(10493): isForeground=true, isBlacklisted=false, isWhitelisted=true, isRestrictedByAdmin=false, oldRule=0 (NONE), newRule=1 (ALLOW_METERED), newUidRules=1 (ALLOW_METERED), oldUidRules=0 (NONE), mRestrictBackground=false
03-04 12:35:54.782 I/MicroMsg.SDK.WXApiImplV10(24777): getTokenFromWX token is OpenSdkToken@1583296554779
03-04 12:35:54.783 D/MicroMsg.SDK.MMessageAct(24777): send, targetPkgName = com.tencent.mm, targetClassName = com.tencent.mm.plugin.base.stub.WXEntryActivity
03-04 12:35:54.784 D/ (24777): addLayerName, tid:24799
03-04 12:35:54.784 I/AISched FPS( 604): currentfps 60,detected fps 60,flag 0,high 12,low 8,sleepPercent 0.775324,old 8,new 8
03-04 12:35:54.788 I/ActivityManager( 1174): START u0 {flg=0x18000000 hwFlg=0x10 cmp=com.tencent.mm/.plugin.base.stub.WXEntryActivity (has extras)} from uid 10512
03-04 12:35:54.789 I/ActivityManager( 1174): ActivityRecord info: ActivityInfo{cb0904a com.tencent.mm.plugin.base.stub.WXEntryActivity}
03-04 12:35:54.793 I/PF_FREQ_GRP( 613): [recordLimitCmd:65] [GPU] end limit freq 550000000 ~ 767000000
03-04 12:35:54.794 I/PG_ash ( 1987): front pkg : com.tencent.mm launcher: false
03-04 12:35:54.794 I/PG_ash ( 1987): above launcher front pkgs: [com.rockgame.kmall, com.tencent.mm]
03-04 12:35:54.800 D/ (24777): addLayerName, tid:24799
03-04 12:35:54.831 V/ActivityManager( 1174): addChild: attaching stackId=38 to displayId=0 position=6
03-04 12:35:54.831 V/ActivityManager( 1174): positionChild stackId=38 to top.
03-04 12:35:54.849 V/ActivityManager( 1174): positionChild stackId=38 to top.
03-04 12:35:54.851 V/WindowManager( 1174): addAppToken: AppWindowToken{36f6716 token=Token{df28431 ActivityRecord{1e7c8d8 u0 com.tencent.mm/.plugin.base.stub.WXEntryActivity t39}}} controller={TaskWindowContainerController taskId=39} at 2147483647
03-04 12:35:54.866 D/ (24777): addLayerName, tid:24799
03-04 12:35:54.867 D/ ( 620): doWinFrameOptStatusRecog begin to recog Layer result=2
03-04 12:35:54.867 I/StatusBarDisable( 1174): setFlags what=0 which=1 pkg=Window{fc9159e u0 com.rockgame.kmall/com.rockgame.kmall.wxapi.WXEntryActivity}
03-04 12:35:54.868 D/MicroMsg.SDK.MMessageAct(24777): send mm message, intent=Intent { flg=0x18000000 cmp=com.tencent.mm/.plugin.base.stub.WXEntryActivity (has extras) }
03-04 12:35:54.868 E/MicroMsg.WXEntryActivity(24777): ShareWX 888
03-04 12:35:54.884 D/ (24777): addLayerName, tid:24799
03-04 12:35:54.887 D/Cocos2dxActivity(24777): onPause()
03-04 12:35:54.887 D/ZrHung.AppEyeUiProbe(24777): stop checker.
03-04 12:35:54.888 V/ActivityManager( 1174): Making visible and scheduling visibility: ActivityRecord{1e7c8d8 u0 com.tencent.mm/.plugin.base.stub.WXEntryActivity t39}
03-04 12:35:54.888 I/NetworkPolicy( 1174): updateRuleForRestrictBackgroundUL(10493): isForeground=false, isBlacklisted=false, isWhitelisted=true, isRestrictedByAdmin=false, oldRule=1 (ALLOW_METERED), newRule=0 (NONE), newUidRules=0 (NONE), oldUidRules=1 (ALLOW_METERED), mRestrictBackground=false
03-04 12:35:54.888 D/HwPhoneWindowManager( 1174): sensorRotation = -1 lastRotation:0
03-04 12:35:54.890 W/ActivityThread(19164): handleWindowVisibility: no activity for token android.os.BinderProxy@bed77d3
03-04 12:35:54.897 I/AppFastHibernation( 1987): rev F_Z exception for visible pkg: com.tencent.mm
03-04 12:35:54.898 D/ (24777): addLayerName, tid:24799
03-04 12:35:54.913 W/HwActivityManagerServiceEx( 1174): appSwitch from: com.rockgame.kmall to: com.tencent.mm
03-04 12:35:54.913 W/HwActivityManagerServiceEx( 1174): HwActivityNotifier end call for appSwitch under user 0 cost 0
03-04 12:35:54.913 D/AssistantService-1000102( 1905): registerHwActivityNotifier call fromPackage:com.rockgame.kmall, toPackage:com.tencent.mm
03-04 12:35:54.914 D/AssistantService-1000102( 1905): handleMessage app switch fromPackage:com.rockgame.kmall, toPackage:com.tencent.mm
03-04 12:35:54.914 D/HwGameAssistantController( 1174): UPDATE: mCurFgPkg=com.tencent.mm, mCurFgPid=19164, mCurIsGame=false
03-04 12:35:54.914 D/HwGameAssistantController( 1174): getGameList: []
03-04 12:35:54.914 D/AssistantService-1000102( 1905): package:com.rockgame.kmall inAppAssistant:false
03-04 12:35:54.914 D/ZrHung.AppEyeFocusWindow( 1174): FocusWindowErrorScene CheckFreezeScreen
03-04 12:35:54.914 D/ZrHung.AppEyeTransparentWindow( 1174): TransparentWindow cancelCheckFreezeScreen
03-04 12:35:54.914 D/AssistantService-1000102( 1905): package:com.tencent.mm inAppAssistant:false
03-04 12:35:54.914 D/ScenarioService( 1987): front pkg : com.tencent.mm launcher: false
03-04 12:35:54.914 D/ScenarioService( 1987): new above launcher front pkgs: [com.rockgame.kmall, com.tencent.mm]
03-04 12:35:54.914 I/AppManager( 1987): handleAppFrontEvent: com.tencent.mm
03-04 12:35:54.914 D/ZrHung.AppEyeUiProbe(19164): notify runnable to start.
03-04 12:35:54.914 D/ZrHung.AppEyeUiProbe(19164): restart watching