Unresolved Class ParseFirebaseInstanceIdService in AndroidManifest
Asked Answered
A

2

5

Context: Implementing Cloud Push Notifications on Android via Parse Server

as Backend and Firebase Cloud Messaging Service

Goal: Sending a push notification from Parse to the subject Android Application

Problem: When injecting class com.parse.fcm.ParseFirebaseInstanceIdService into AndroidManifest.xml file, it goes unresolved.

Already-tried Solutions: Changing the Firebase and Parse packages versions in build.gradle (App File) as well as changing the dependencies versions in build.gralde (Project File)

Project files:

AndroidManifest.xml (Portion of the file where the error occurs)

<service
        android:name="com.parse.fcm.ParseFirebaseInstanceIdService"
        android:exported="true">
        <intent-filter>
            <action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
        </intent-filter>
    </service>

build.gradle (Project)

     buildscript {
        repositories {
            google()
            jcenter()

        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.5.1'
            classpath 'com.google.gms:google-services:4.0.1'

        }
    }

    allprojects {
        repositories {
            google()
            jcenter()
            maven { url "https://jitpack.io" }
        }
    }
    task clean(type: Delete) {
        delete rootProject.buildDir 
}

build.gradle (Module)

apply plugin: 'com.android.application'

    android {
        compileSdkVersion 29
        buildToolsVersion "29.0.1"
        defaultConfig {
            applicationId "com.sytech.uber"
            minSdkVersion 24
            targetSdkVersion 29
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'androidx.appcompat:appcompat:1.1.0'
        implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
        implementation 'com.google.android.gms:play-services-maps:16.1.0'
        implementation 'com.google.firebase:firebase-analytics:17.2.0'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'androidx.test.ext:junit:1.1.1'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
        //Parse
        implementation "com.github.parse-community.Parse-SDK-Android:parse:1.20.0"
        implementation "com.github.parse-community.Parse-SDK-Android:fcm:1.20.0"
        implementation 'com.parse.bolts:bolts-android:1.4.0'
        //Toasty  https://github.com/GrenderG/Toasty
        implementation 'com.github.GrenderG:Toasty:1.4.2'
        //Firebase 
        implementation'com.google.firebase:firebase-auth:19.1.0'
        implementation 'com.google.firebase:firebase-messaging:17.6.0'
        implementation 'com.google.firebase:firebase-core:16.0.8'
    }

    apply plugin: 'com.google.gms.google-services'
    com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
Annmaria answered 17/10, 2019 at 11:12 Comment(1)
@VivekMishra I'm currently using back4app.com and so far it's going well, however, you are correct and I'll be migrating completely to Firebase real soon.Annmaria
F
6

FirebaseInstanceIdService is no longer usable. Use latest version of parse and FirebaseMessagingService

implementation "com.github.parse-community.Parse-SDK-Android:fcm:1.21.0"

And use ParseFirebaseMessagingService

<service
    android:name="com.parse.fcm.ParseFirebaseMessagingService">
    <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT"/>
    </intent-filter>
</service>
Frieda answered 17/10, 2019 at 11:21 Comment(1)
Well, it solved the problem, Thanks, Although my Goal of sending a notification from Parse Server hasn't been achieved yet. I'm still trying to determine the problem.Annmaria
K
1

Just to add to Md. Asaduzzaman's answer, make sure to override the onNewToken() method in your custom FirebaseMessagingService, like in this tutorial. (I just found the tutorial and thought it would be nice to share it if others are stuck with the same problem).

@Override
public void onNewToken(String s) {
    super.onNewToken(s);
    Log.i("NEW_TOKEN", s);
}

We need to override it because:

"FirebaseInstanceIdService: This class was deprecated. In favour of overriding onNewToken in FirebaseMessagingService.

Once that has been implemented, this service can be safely removed."

Kidwell answered 18/11, 2019 at 9:29 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.