是不是跟ShareSDK冲突了
Android app 拉起小程序后再唤起app,app的回调没有执行import android.content.Intent; import android.util.Log; import android.widget.Toast; import com.i84.cpn.andr.help.ToastHelper; import com.tencent.mm.opensdk.constants.ConstantsAPI; import com.tencent.mm.opensdk.modelbiz.WXLaunchMiniProgram; import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler; import cn.sharesdk.wechat.utils.WXAppExtendObject; import cn.sharesdk.wechat.utils.WXMediaMessage; import cn.sharesdk.wechat.utils.WechatHandlerActivity; /** 微信客户端回调activity示例 */ public class WXEntryActivity extends WechatHandlerActivity implements IWXAPIEventHandler { /** * 处理微信发出的向第三方应用请求app message * <p> * 在微信客户端中的聊天页面有“添加工具”,可以将本应用的图标添加到其中 * 此后点击图标,下面的代码会被执行。Demo仅仅只是打开自己而已,但你可 * 做点其他的事情,包括根本不打开任何页面 */ public void onGetMessageFromWXReq(WXMediaMessage msg) { Intent iLaunchMyself = getPackageManager().getLaunchIntentForPackage(getPackageName()); startActivity(iLaunchMyself); } /** * 处理微信向第三方应用发起的消息 * <p> * 此处用来接收从微信发送过来的消息,比方说本demo在wechatpage里面分享 * 应用时可以不分享应用文件,而分享一段应用的自定义信息。接受方的微信 * 客户端会通过这个方法,将这个信息发送回接收方手机上的本demo中,当作 * 回调。 * <p> * 本Demo只是将信息展示出来,但你可做点其他的事情,而不仅仅只是Toast */ public void onShowMessageFromWXReq(WXMediaMessage msg) { if (msg != null && msg.mediaObject != null && (msg.mediaObject instanceof WXAppExtendObject)) { WXAppExtendObject obj = (WXAppExtendObject) msg.mediaObject; Toast.makeText(this, obj.extInfo, Toast.LENGTH_SHORT).show(); } } @Override public void onReq(com.tencent.mm.opensdk.modelbase.BaseReq baseReq) { Log.e("wetch",baseReq.getType() + ""); } @Override public void onResp(com.tencent.mm.opensdk.modelbase.BaseResp baseResp) { if (baseResp.getType() == ConstantsAPI.COMMAND_LAUNCH_WX_MINIPROGRAM) { WXLaunchMiniProgram.Resp launchMiniProResp = (WXLaunchMiniProgram.Resp) baseResp; String extraData =launchMiniProResp.extMsg; // 对应下面小程序中的app-parameter字段的value ToastHelper.showToast(extraData); Log.e("wetch",extraData); } } }
2020-08-12好吧,转换思路后自己发现了问题,原来并非自己接入的问题。因为接入了ShareSDK分享,微信登录回调就不会调用WXEntryActivity onCreate了.
微信登录不调用WXEntryActivity onCreate----实在没找到登录专区PS:实在没找到登录专区,所以只能发支付专区来了 Android按官方文档一步步集成,但是调起登录授权,拉起应用后不会调用WXEntryActivity onCreate方法,自然也就不会调用onResp,能确认到包名及签名全部都没问题,混淆设置也加了,且在debug下没有开启混淆,机型也换了好几个测试,微信的控制台日志也对比了,正常情况和异常情况日志完全一样。重新建一个简单demo应用,包名及签名设置成一样的又可以调起,放到正式App中就不行了。从自己的应用日志上看,正常是会调用WXEntryActivity onCreate的,也实在想不明白还有什么原因能影响WXEntryActivity页面的拉起,卡了半月有余,特此求助,如遇开导,不胜感激。微信号(ROLAN_WANG)已于2020-08-12上午11点多上传了日志,微信官方同学看到也麻烦帮看一下 [图片] [图片] [图片] [图片][图片] 正常日志:可以看到以下两个关键日志 08-12 11:07:26.399 32725 32725 I MicroMsg.SDK.WXApiImplV10: handleIntent, cmd = 1 08-12 11:07:28.088 32725 32725 W Activity: Slow Operation: Activity com.cocos2d.starFuns/.wxapi.WXEntryActivity onCreate took 6137ms ================================================================================================================= 21.919 1614 3197 I ActivityTaskManager: The Process com.cocos2d.starFuns Already Exists in BG. So sending its PID: 32725 08-12 11:07:21.922 4503 17663 I ProcessMonitor: onForegroundInfoChanged: ForegroundInfo{mForegroundPackageName='com.cocos2d.starFuns', mForegroundUid=10531, mForegroundPid=32725, mLastForegroundPackageName='com.tencent.mm', mLastForegroundUid=10483, mLastForegroundPid=3167, mMultiWindowForegroundPackageName='null', mMultiWindowForegroundUid=-1, mFlags=0} 08-12 11:07:21.922 4503 17663 D GameBoosterService: onGameStatusChange foreground:ForegroundInfo{mForegroundPackageName='com.cocos2d.starFuns', mForegroundUid=10531, mForegroundPid=32725, mLastForegroundPackageName='com.tencent.mm', mLastForegroundUid=10483, mLastForegroundPid=3167, mMultiWindowForegroundPackageName='null', mMultiWindowForegroundUid=-1, mFlags=0} 08-12 11:07:21.935 32725 32725 W ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@8068178 08-12 11:07:26.396 32725 407 D ViewContentFactory: initViewContentFetcherClass 08-12 11:07:26.397 32725 407 I ContentCatcher: ViewContentFetcher : ViewContentFetcher 08-12 11:07:26.398 32725 407 D ViewContentFactory: createInterceptor took 2ms 08-12 11:07:26.399 32725 32725 I MicroMsg.SDK.WXApiImplV10: handleIntent, cmd = 1 08-12 11:07:28.088 32725 32725 W Activity: Slow Operation: Activity com.cocos2d.starFuns/.wxapi.WXEntryActivity onCreate took 6137ms 08-12 11:07:28.163 32725 32725 W Looper : Slow Looper main: Long Msg: seq=122 plan=11:07:21.925 late=9ms wall=6223ms running=128ms runnable=8ms h=android.app.ActivityThread$H w=159 08-12 11:07:28.164 32725 32725 W Looper : Slow Looper main: Activity com.cocos2d.starFuns/.wxapi.WXEntryActivity is 6237ms late (wall=0ms running=0ms ClientTransaction{ callbacks=[android.app.servertransaction.TopResumedActivityChangeItem] }) because of 4 msg, msg 4 took 6223ms (seq=122 running=128ms runnable=8ms late=9ms h=android.app.ActivityThread$H w=159) ================================================================================================================= 异常日志:没有正常情况的两个初始化关键日志 08-12 11:20:24.045 1614 3180 I ActivityTaskManager: The Process com.cocos2d.starFuns Already Exists in BG. So sending its PID: 999 08-12 11:20:24.092 4503 9577 I ProcessMonitor: onForegroundInfoChanged: ForegroundInfo{mForegroundPackageName='com.cocos2d.starFuns', mForegroundUid=10531, mForegroundPid=999, mLastForegroundPackageName='com.tencent.mm', mLastForegroundUid=10483, mLastForegroundPid=3167, mMultiWindowForegroundPackageName='null', mMultiWindowForegroundUid=-1, mFlags=0} 08-12 11:20:24.093 4503 9577 D GameBoosterService: onGameStatusChange foreground:ForegroundInfo{mForegroundPackageName='com.cocos2d.starFuns', mForegroundUid=10531, mForegroundPid=999, mLastForegroundPackageName='com.tencent.mm', mLastForegroundUid=10483, mLastForegroundPid=3167, mMultiWindowForegroundPackageName='null', mMultiWindowForegroundUid=-1, mFlags=0} 08-12 11:20:24.116 26858 26858 W FeedbackControl: type=1400 audit(0.0:282488): avc: denied { read } for name="stat" dev="proc" ino=14519991 scontext=u:r:system_app:s0 tcontext=u:r:untrusted_app_27:s0:c227,c257,c512,c768 tclass=file permissive=0 08-12 11:20:24.147 999 999 V MediaPlayer: resetDrmState: mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false 08-12 11:20:24.147 999 999 V MediaPlayer: cleanDrmObj: mDrmObj=null mDrmSessionId=null 08-12 11:20:24.147 999 999 V MediaPlayer: resetDrmState: mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false 08-12 11:20:24.148 999 999 V MediaPlayer: cleanDrmObj: mDrmObj=null mDrmSessionId=null 08-12 11:20:24.148 1614 3812 I MediaFocusControl: abandonAudioFocus() from uid/pid 10531/999 clientId=android.media.AudioManager@cbd195b 08-12 11:20:24.150 999 999 D JIGUANG-JCore: [JCoreHelper] runActionWithService action:change_foreground 08-12 11:20:24.175 999 1687 D ViewContentFactory: initViewContentFetcherClass 08-12 11:20:24.175 999 1687 I ContentCatcher: ViewContentFetcher : ViewContentFetcher 08-12 11:20:24.175 999 1687 D ViewContentFactory: createInterceptor took 0ms 08-12 11:20:24.210 999 999 D JIGUANG-JCore: [JCoreHelper] runActionWithService action:change_foreground 08-12 11:20:24.212 999 999 D JIGUANG-JCore: [JCoreHelper] runActionWithService action:notification_state 08-12 11:20:24.227 999 999 W ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@759191b 08-12 11:20:24.234 999 1687 D ViewContentFactory: initViewContentFetcherClass 08-12 11:20:24.234 999 1687 I ContentCatcher: ViewContentFetcher : ViewContentFetcher 08-12 11:20:24.234 999 1687 D ViewContentFactory: createInterceptor took 0ms 08-12 11:20:24.293 1614 3812 I MediaFocusControl: requestAudioFocus() from uid/pid 10531/999 clientId=android.media.AudioManager@b788d0 callingPack=com.cocos2d.starFuns req=1 flags=0x0 sdk=28 08-12 11:20:24.298 1100 1213 D NuPlayerDriver: NuPlayerDriver(0xf17b5400) created, clientPid(999) 08-12 11:20:24.303 2342 3171 D Avrcp_ext: AudioManager Player: ID:5255 -- type:android.media.MediaPlayer -- u/pid:10531/999 -- state:idle -- attr:AudioAttributes: usage=USAGE_MEDIA content=CONTENT_TYPE_MOVIE flags=0x800 tags= bundle=null
2020-08-12