Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
930 views
in Technique[技术] by (71.8m points)

android - Error while delivering the message: ServiceIntent not found

I'm trying to integrate AWS SNS push services with FCM in my Android app.
When I'm trying to send a push message through SNS online console, I get this error log:

E/FirebaseInstanceId: Failed to resolve target intent service, skipping classname enforcement
E/PushListenerService: From: ************ /* My Sender ID*/
E/PushListenerService: Message: hola
E/FirebaseInstanceId: Error while delivering the message: ServiceIntent not found.

I've searched a bit online, and I found a seemed to be a very popular answer, with 3 services with the classes GcmIntentService, GcmIDListenerService, RegistrationIntentService. I've added those classes and services into my app, but I still don't get any push notifications from SNS.
I also wasn't sure if it is the right solution for me, since I'm not only use FCM Services, but also SNS Services.

These are my existing receivers and services in 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.intap.appme" />
        </intent-filter>
    </receiver>

    <service android:name=".PushListenerService"
        android:exported="false" >
        <intent-filter>
            <action android:name="com.google.android.c2dm.intent.RECEIVE"/>
        </intent-filter>
    </service>

About the push notifications. When I'm sending it through the SNS online console, I get the above log error, but when I'm sending it through the Firebase online console, the device gets the push notification, but I still get this log, which is the first and the last lines of the log above:

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

build.gradle dependencies:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    wearApp project(':wear')
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:24.1.1'
    compile 'com.android.support:design:24.1.1'
    compile fileTree(dir: 'libs', include: ['activation.jar'])
    compile fileTree(dir: 'libs', include: ['additionnal.jar'])
    compile fileTree(dir: 'libs', include: ['mail.jar'])
    compile 'com.amazonaws:aws-android-sdk-core:2.2.18'
    compile 'com.amazonaws:aws-android-sdk-s3:2.2.18'
    compile 'com.amazonaws:aws-android-sdk-ddb:2.2.18'
    compile 'com.amazonaws:aws-android-sdk-ddb-mapper:2.2.18'
    compile 'com.amazonaws:aws-android-sdk-ec2:2.2.18'
    compile 'com.google.android.gms:play-services-plus:9.0.1'
    compile 'com.amazonaws:aws-android-sdk-sns:2.2.18'
    compile 'com.google.android.gms:play-services-gcm:9.0.1'
    compile 'com.android.support:multidex:1.0.1'
    apply plugin: 'com.google.gms.google-services'
}

Could you please help me figure it out and solve it?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

First you should apply the google-services plugin after the dependency block not in it. Also I'm not seeing any dependency that is adding FirebaseInstanceID so I'm not sure why that error is showing up. Also using FCM and GCM together is not a good idea since you have multiple receivers for the same message. Use one or the other. That could be why the sns messages are not being received.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...