游戏在接入时遇见了一个比较奇怪的问题,取消支付时返回游戏显示的是欢迎页面
查看log信息时,发现在点击支付时抛出了以下的错误信息:
02-23 15:55:46.511 32387-32387/? E/ActivityThread: Activity com.mfp.jellyblast.AppActivity has leaked IntentReceiver com.nearme.game.sdk.component.PayResultReceiver@3269740 that was originally registered here. Are you missing a call to unregisterReceiver()?
android.app.IntentReceiverLeaked: Activity com.mfp.jellyblast.AppActivity has leaked IntentReceiver com.nearme.game.sdk.component.PayResultReceiver@3269740 that was originally registered here. Are you missing a call to unregisterReceiver()?at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:920)
at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:721)
at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1182)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1162)
at android.app.ContextImpl.registerReceiver(ContextImpl.java:1156)
at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:564)
at com.nearme.game.sdk.b$3.onSuccess(GCInternalImpl.java:196)
at com.nearme.game.sdk.a$8.handleMessage(GCInternal.java:446)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5458)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:738)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:628)
看了半天没想出是哪的错误,最后通过查看录屏时发现,原来在支付时activity发生了旋转,导致activity重新生成了,这也就解释了为什么会显示欢迎页面(ps:欢迎页面是在activity当中添加的)。解决方法是在activity声明中添加android:configChanges="keyboardHidden|orientation|screenSize",关于configChanges的说明参看http://blog.csdn.net/akiyame/article/details/44923335。