问题描述
当我们的服务器发送推送通知时,我的应用程序日志中出现了这两个错误: gcm / p>在我的应用程序文件夹中,我得到了 google -services.json
文件。
我已将 2所需服务和接收方添加到我的清单:
< receiver
android:name =com.google.android.gms.gcm.GcmReceiver
android:exported =true
android:permission =com.google.android.c2dm.permission.SEND>
< intent-filter>
< category android:name =com.myapppackage.application/>
< / intent-filter>
< / receiver>
< service
android:name =com.myapppackage.application.gcm.newgcm.RegisterGCMTokenService
android:exported =false>
< / service>
< service
android:name =com.myapppackage.application.gcm.newgcm.MyInstanceIDListenerService
android:exported =false>
< intent-filter>
< / intent-filter>
< / service>
我有也将这两个添加为java类。并上传到我们的服务器是好的。 我也推出了'事件',但不知何故,我得到了上述2个错误,并且没有任何消息。 项目编号从google api控制台到 strings.xml
作为'google_app_id'
API键应该没问题,因为我确实得到了推送事件,但不知何故提供了该消息。
我的gradle的应用程序级别依赖项包含:
$ b
compile'com.google.android。 gms:play-services:8. +'
我的gradle的项目级依赖项具有:
classpath'com.google.gms:google-services:1.3.1'
所以到底是什么?!如果可以,请帮助我。
您应该在清单中包含这3个服务。您错过了 com.google.android.c2dm.intent.RECEIVE
< service
android:name =com.myapppackage.application.gcm.GcmIntentService
android:exported =false>
< intent-filter>
< / intent-filter>
< / service>
< service
android:name =com.myapppackage.application.gcm.GcmIDListenerService
android:exported =false>
< intent-filter>
< / intent-filter>
< / service>
< service
android:name =com.myapppackage.application.gcm.RegistrationIntentService
android:exported =false/>
I try to make gcm work.
When our server sends a push notification I got these two errors in my app's log:
In my app's folder I got the google-services.json
file.
I have added the 2 needed services and the receiver to my Manifest:
<receiver
android:name="com.google.android.gms.gcm.GcmReceiver"
android:exported="true"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.myapppackage.application" />
</intent-filter>
</receiver>
<service
android:name="com.myapppackage.application.gcm.newgcm.RegisterGCMTokenService"
android:exported="false">
</service>
<service
android:name="com.myapppackage.application.gcm.newgcm.MyInstanceIDListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID"/>
</intent-filter>
</service>
I have also added these two as java classes. The gcm token providing and uploading to our server's is fine. I also got the push 'event' but somehow I got those 2 errors above, and no messages.
I have added my project number from google api console to strings.xml
as 'google_app_id'
The API keys should be all right because I do get the push event, but somehow the message is not provided.
My gradle's app level dependencies have:
compile 'com.google.android.gms:play-services:8.+'
My gradle's project level dependencies have:
classpath 'com.google.gms:google-services:1.3.1'
So what the heck?! Please help me if you can.
You should have these 3 services in your manifest. You're missing the one with the action com.google.android.c2dm.intent.RECEIVE
<service
android:name="com.myapppackage.application.gcm.GcmIntentService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
</intent-filter>
</service>
<service
android:name="com.myapppackage.application.gcm.GcmIDListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.android.gms.iid.InstanceID" />
</intent-filter>
</service>
<service
android:name="com.myapppackage.application.gcm.RegistrationIntentService"
android:exported="false"/>
这篇关于无法解析目标意图服务,传递消息时发生错误:未找到ServiceIntent的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!