Android收不到通知 showNotification failed failed:Can't create handler inside thread that has not called Looper.prepare()**

标签: #<Tag:0x00007f657f132338>

Android集成jpush:3.3.4后在手机和模拟器上都不能正常收到推送。

以下是具体日志,望回复,谢谢!

2019-08-07 09:18:31.785 25213-25277/cn.ische.uhoer.store:pushcore I/JIGUANG-JCore-IMPL: [ConnectingHelper] Login with - juid:25679496281, appKey:d1bbde2a5a1769f3771e8e47, sdkVersion:131330|197380, pluginPlatformType:0
2019-08-07 09:18:31.786 25213-25277/cn.ische.uhoer.store:pushcore D/JIGUANG-JCore-IMPL: [JCommonInterface] onEvent action:get_loc_info
2019-08-07 09:18:31.790 25213-25274/cn.ische.uhoer.store:pushcore D/JIGUANG-JCore-IMPL: [JCommonInterface] onEvent action:on_register
2019-08-07 09:18:31.856 25213-25277/cn.ische.uhoer.store:pushcore I/JIGUANG-JCore-IMPL: [ConnectingHelper] Login succeed - sid:50202, serverTime;1565140712000
2019-08-07 09:18:31.857 25213-25277/cn.ische.uhoer.store:pushcore D/JIGUANG-JCore-IMPL: [NetworkingClient] Network listening…
2019-08-07 09:18:31.857 25213-25274/cn.ische.uhoer.store:pushcore D/JIGUANG-JCore-IMPL: [JCoreTCPManager] Action - onLoggedIn
2019-08-07 09:18:31.859 25213-25274/cn.ische.uhoer.store:pushcore I/JIGUANG-JPush: [ThirdPushManager] uploadRegIdAfterLogin
2019-08-07 09:18:31.860 25213-25274/cn.ische.uhoer.store:pushcore D/JIGUANG-JCore-IMPL: [JCommonInterface] onEvent action:periodtask
2019-08-07 09:18:31.940 25213-25274/cn.ische.uhoer.store:pushcore D/JIGUANG-JCore-IMPL: [JCommonInterface] onEvent action:getwakeenable
2019-08-07 09:18:32.009 25213-25402/cn.ische.uhoer.store:pushcore D/JIGUANG-JCore-IMPL: [JCommonInterface] onEvent action:filter_pkg_list
2019-08-07 09:18:32.088 25213-25257/cn.ische.uhoer.store:pushcore D/JIGUANG-JPush: [ActionHelper] doAction:init
2019-08-07 09:18:33.968 25213-25277/cn.ische.uhoer.store:pushcore D/JIGUANG-JCore-IMPL: [NetworkingClient] Received bytes - len:36, pkg:cn.ische.uhoer.store
2019-08-07 09:18:33.969 25213-25277/cn.ische.uhoer.store:pushcore D/JIGUANG-JCore-IMPL: [NetworkingClient] Network listening…
2019-08-07 09:18:34.963 25213-25277/cn.ische.uhoer.store:pushcore D/JIGUANG-JCore-IMPL: [NetworkingClient] Received bytes - len:36, pkg:cn.ische.uhoer.store
2019-08-07 09:18:34.965 25213-25277/cn.ische.uhoer.store:pushcore D/JIGUANG-JCore-IMPL: [NetworkingClient] Network listening…
2019-08-07 09:18:55.885 25150-25150/cn.ische.uhoer.store D/JIGUANG-JCore: [JCoreHelper] runActionWithService action:tagalis
2019-08-07 09:18:55.887 25213-25257/cn.ische.uhoer.store:pushcore D/JIGUANG-JPush: [ActionHelper] doAction:tagalis
2019-08-07 09:18:55.891 25213-25275/cn.ische.uhoer.store:pushcore D/JIGUANG-JPush: [TagAliasHelper] tagalias:{“platform”:“a”,“op”:“set”,“alias”:“93d28bc58721422bbfbf183825528925”}
2019-08-07 09:18:56.673 25213-25277/cn.ische.uhoer.store:pushcore D/JIGUANG-JCore-IMPL: [NetworkingClient] Received bytes - len:36, pkg:cn.ische.uhoer.store
2019-08-07 09:18:56.676 25213-25277/cn.ische.uhoer.store:pushcore D/JIGUANG-JCore-IMPL: [NetworkingClient] Network listening…
2019-08-07 09:18:56.684 25213-25454/cn.ische.uhoer.store:pushcore D/JIGUANG-JPush: [ActionHelper] doAction:msg
2019-08-07 09:18:56.689 25213-25275/cn.ische.uhoer.store:pushcore D/JIGUANG-JPush: [JPushActionImpl] action:handleMsg:JPushResponse{cmd=29, rid=5745, rquestId=2}
2019-08-07 09:19:30.722 25213-25277/cn.ische.uhoer.store:pushcore D/JIGUANG-JCore-IMPL: [NetworkingClient] Received bytes - len:388, pkg:cn.ische.uhoer.store
2019-08-07 09:19:30.725 25213-25277/cn.ische.uhoer.store:pushcore D/JIGUANG-JCore-IMPL: [NetworkingClient] Network listening…
2019-08-07 09:19:30.733 25213-25454/cn.ische.uhoer.store:pushcore D/JIGUANG-JPush: [ActionHelper] doAction:msg
2019-08-07 09:19:30.737 25213-25275/cn.ische.uhoer.store:pushcore D/JIGUANG-JPush: [JPushActionImpl] action:handleMsg:JPushResponse{cmd=3, rid=0, rquestId=-1}
2019-08-07 09:19:30.776 25213-25275/cn.ische.uhoer.store:pushcore W/JIGUANG-JPush: [MessageHelper] no message or extra send to user
2019-08-07 09:19:30.787 25213-25595/cn.ische.uhoer.store:pushcore D/JIGUANG-JCore: [JCoreHelper] runActionWithService action:notification_state
2019-08-07 09:19:30.792 25213-25257/cn.ische.uhoer.store:pushcore D/JIGUANG-JCore-IMPL: [JCommonInterface] onEvent action:notification_state

19**-08-07 09:19:30.795 25213-25595/cn.ische.uhoer.store:pushcore E/JIGUANG-JPush: [NotificationHelper] showNotification failed:Can’t create handler inside thread that has not called Looper.prepare()

检查一下,你们是否在接收通知的时候用handler处理了?

没有。我们onNotifyMessageArrived方法里面就一个打印输出,我在控制台发了消息就报 JIGUANG- **JPush: [NotificationHelper] showNotification failed:**这个错误。onNotifyMessageArrived这个方法里面也没有输出我的打印

你们先用最原始的方法 就是接收到消息不用任何处理 先看看看能不能收到通知

可以参考下 demo的处理逻辑。

给下你们处理消息的代码

    MyLog.i("打印","收到通知=======" + new Gson().toJson(message));

就这一句打印

有没有自定义接收器,把你们完整的处理消息代码的文件发一下,可私信提供。

PushReceiver.txt (1.7 KB)
这是自定义的接收器,java文件不让传,我把后缀改成txt了,麻烦看下,谢谢!

不好意思已经解决了,找错自定义消息的处理类了。非常感谢官方的回复!!!

可以详细说明下你错误的点吗?我这边提交了研发分析,需要备注下解决结果 :sweat_smile:

我找错类了。用的类是因为初始化了handler,之前一直找错类了。非常感谢您的解答

1赞