gpt4 book ai didi

android - 无法解析目标 Intent 服务,传递消息 : ServiceIntent not found 时出错

转载 作者:可可西里 更新时间:2023-11-01 18:47:52 25 4
gpt4 key购买 nike

我尝试让 gcm 正常工作。

当我们的服务器发送推送通知时,我在我的应用程序日志中收到以下两个错误:

E/GcmReceiver(8049): Failed to resolve target intent service, skipping classname enforcement E/GcmReceiver(8049): Error while delivering the message: ServiceIntent not found.

在我的应用程序文件夹中,我得到了 google-services.json 文件。

我已将2 个需要的服务和接收器 添加到我的 list 中:

  <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>

也将这两个添加为 java 类。 提供并上传到我们服务器的 gcm token 没问题。 我也收到了推送“事件”,但不知何故我收到了上述 2 个错误,但没有任何消息。

我已将我的项目编号从 google api 控制台添加到 strings.xml 作为 'google_app_id'

API key 应该没问题,因为我确实收到了推送事件,但不知何故未提供消息。

我的 gradle 的应用级依赖项有:

compile 'com.google.android.gms:play-services:8.+'

我的 gradle 的项目级依赖项有:

classpath 'com.google.gms:google-services:1.3.1'

那么到底是怎么回事?!如果可以的话请帮助我。

最佳答案

您的 list 中应该包含这 3 项服务。您错过了带有 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"/>

关于android - 无法解析目标 Intent 服务,传递消息 : ServiceIntent not found 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36132798/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com