问题是我的自定义接收器正在调用通知生成方法,我收到两个推送通知,当我注释掉通知生成代码时,我仍然收到一个通知
此单一通知的logcat是此
11-21 15:55:51.091 17996-17996/com.lafalafa.android D/ActivityThread: BDC-Calling onReceive: intent=Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10000010 pkg=com.lafalafa.android cmp=com.lafalafa.android/com.lafalafa.services.Receiver (has extras) }, receiver=com.lafalafa.services.Receiver@264a8db5
11-21 15:55:51.092 17996-17996/com.lafalafa.android D/ActivityThread: BDC-RECEIVER handled : 0 / ReceiverData{intent=Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10000010 pkg=com.lafalafa.android cmp=com.lafalafa.android/com.lafalafa.services.Receiver (has extras) } packageName=com.lafalafa.android resultCode=0 resultData=null resultExtras=null}
11-21 15:55:51.094 17996-17996/com.lafalafa.android D/ActivityThread: BDC-Calling onReceive: intent=Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10000010 pkg=com.lafalafa.android cmp=com.lafalafa.android/com.google.firebase.iid.FirebaseInstanceIdReceiver (has extras) }, receiver=com.google.firebase.iid.FirebaseInstanceIdReceiver@13e9ac4a
11-21 15:55:51.105 17996-17996/com.lafalafa.android D/ActivityThread: SVC-Calling onStartCommand: com.google.firebase.messaging.FirebaseMessagingService@2b2c44d8, flags=0, startId=1
11-21 15:55:51.104 17996-17996/com.lafalafa.android D/ActivityThread: BDC-RECEIVER handled : 0 / ReceiverData{intent=Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10000010 pkg=com.lafalafa.android (has extras) } packageName=com.lafalafa.android resultCode=-1 resultData=null resultExtras=null}
11-21 15:55:51.105 17996-17996/com.lafalafa.android D/ActivityThread: SVC-Creating service: CreateServiceData{token=android.os.BinderProxy@383917bb className=com.google.firebase.messaging.FirebaseMessagingService packageName=com.lafalafa.android intent=null}
11-21 15:55:51.105 17996-17996/com.lafalafa.android D/ActivityThread: SVC-CREATE_SERVICE handled : 0 / CreateServiceData{token=android.os.BinderProxy@383917bb className=com.google.firebase.messaging.FirebaseMessagingService packageName=com.lafalafa.android intent=null}
11-21 15:55:51.105 17996-17996/com.lafalafa.android D/ActivityThread: SVC-SERVICE_ARGS handled : 0 / ServiceArgsData{token=android.os.BinderProxy@383917bb startId=1 args=Intent { act=com.google.firebase.MESSAGING_EVENT pkg=com.lafalafa.android cmp=com.lafalafa.android/com.google.firebase.messaging.FirebaseMessagingService (has extras) }}
11-21 15:55:51.142 17996-23053/com.lafalafa.android D/FA: Logging event (FE): _nr, Bundle[{_o=fcm, _ndt=0, _nmn=say what, _nmt=1479723949, _nmid=4353520786650478530}]
11-21 15:55:51.144 17996-23053/com.lafalafa.android V/FA: Using measurement service
11-21 15:55:51.145 17996-23053/com.lafalafa.android V/FA: Connecting to remote service
11-21 15:55:51.197 17996-17996/com.lafalafa.android D/ActivityThread: SVC-Destroying service: com.google.firebase.messaging.FirebaseMessagingService@2b2c44d8
11-21 15:55:51.198 17996-17996/com.lafalafa.android D/ActivityThread: SVC-STOP_SERVICE handled : 0 / android.os.BinderProxy@383917bb
11-21 15:55:51.199 17996-23053/com.lafalafa.android D/FA: Connected to remote service
11-21 15:55:51.200 17996-23053/com.lafalafa.android V/FA: Processing queued up service tasks: 1
11-21 15:55:56.310 17996-23053/com.lafalafa.android V/FA: Inactivity, disconnecting from AppMeasurementService
11-21 15:57:40.117 17996-17996/com.lafalafa.android D/ActivityThread: BDC-Calling onReceive: intent=Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10000010 pkg=com.lafalafa.android cmp=com.lafalafa.android/com.lafalafa.services.Receiver (has extras) }, receiver=com.lafalafa.services.Receiver@d577497
11-21 15:57:40.117 17996-17996/com.lafalafa.android D/ActivityThread: BDC-RECEIVER handled : 0 / ReceiverData{intent=Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10000010 pkg=com.lafalafa.android cmp=com.lafalafa.android/com.lafalafa.services.Receiver (has extras) } packageName=com.lafalafa.android resultCode=0 resultData=null resultExtras=null}
11-21 15:57:40.120 17996-17996/com.lafalafa.android D/ActivityThread: BDC-Calling onReceive: intent=Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10000010 pkg=com.lafalafa.android cmp=com.lafalafa.android/com.google.firebase.iid.FirebaseInstanceIdReceiver (has extras) }, receiver=com.google.firebase.iid.FirebaseInstanceIdReceiver@178cd684
11-21 15:57:40.129 17996-17996/com.lafalafa.android D/ActivityThread: BDC-RECEIVER handled : 0 / ReceiverData{intent=Intent { act=com.google.android.c2dm.intent.RECEIVE flg=0x10000010 pkg=com.lafalafa.android (has extras) } packageName=com.lafalafa.android resultCode=-1 resultData=null resultExtras=null}
11-21 15:57:40.130 17996-17996/com.lafalafa.android D/ActivityThread: SVC-Calling onStartCommand: com.google.firebase.messaging.FirebaseMessagingService@3d337aa2, flags=0, startId=1
11-21 15:57:40.129 17996-17996/com.lafalafa.android D/ActivityThread: SVC-Creating service: CreateServiceData{token=android.os.BinderProxy@1e6bbe6d className=com.google.firebase.messaging.FirebaseMessagingService packageName=com.lafalafa.android intent=null}
11-21 15:57:40.130 17996-17996/com.lafalafa.android D/ActivityThread: SVC-CREATE_SERVICE handled : 0 / CreateServiceData{token=android.os.BinderProxy@1e6bbe6d className=com.google.firebase.messaging.FirebaseMessagingService packageName=com.lafalafa.android intent=null}
11-21 15:57:40.130 17996-17996/com.lafalafa.android D/ActivityThread: SVC-SERVICE_ARGS handled : 0 / ServiceArgsData{token=android.os.BinderProxy@1e6bbe6d startId=1 args=Intent { act=com.google.firebase.MESSAGING_EVENT pkg=com.lafalafa.android cmp=com.lafalafa.android/com.google.firebase.messaging.FirebaseMessagingService (has extras) }}
11-21 15:57:40.139 17996-24084/com.lafalafa.android D/FA: Logging event (FE): _nr, Bundle[{_o=fcm, _ndt=0, _nmt=1479724060, _nmid=8165985003147150810}]
11-21 15:57:40.140 17996-24084/com.lafalafa.android V/FA: Using measurement service
11-21 15:57:40.141 17996-24084/com.lafalafa.android V/FA: Connecting to remote service
11-21 15:57:40.159 17996-17996/com.lafalafa.android D/ActivityThread: SVC-Destroying service: com.google.firebase.messaging.FirebaseMessagingService@3d337aa2
11-21 15:57:40.161 17996-17996/com.lafalafa.android D/ActivityThread: SVC-STOP_SERVICE handled : 0 / android.os.BinderProxy@1e6bbe6d
11-21 15:57:40.162 17996-24084/com.lafalafa.android D/FA: Connected to remote service
11-21 15:57:40.162 17996-24084/com.lafalafa.android V/FA: Processing queued up service tasks: 1
我不知道这个通知是如何启动的
答案 0 :(得分:0)
您的应用是否处于后台?然后您将从firebase sdk收到一个(自动生成的)通知,而另一个来自您的接收器。
答案 1 :(得分:0)
好的,所以我终于解决了这个问题 我基本上从我的代码中删除了现有的GCM实例,现在代码只发送一条消息。
我后来意识到我们需要从GCM迁移到FCM,而不仅仅是在其上添加FCM。
希望这会有所帮助!!