Reputation: 27
I am facing some errors in an apk build. Here is my code.
package com.my.mybooks.services;
import android.util.Log;
import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.iid.FirebaseInstanceIdService;
/**
* FirebaseInstanceIdService Gets FCM instance ID token from Firebase Cloud Messaging Server
*/
public class MyFirebaseInstanceIDService extends FirebaseInstanceIdService {
//*********** Called whenever the Token is Generated or Refreshed ********//
@Override
public void onTokenRefresh() {
super.onTokenRefresh();
String refreshedToken = FirebaseInstanceId.getInstance().getToken();
Log.i("My_Shop", "refreshedFCMToken= " + refreshedToken);
}
}
error: cannot find symbol import com.google.firebase.iid.FirebaseInstanceIdService; ^ symbol: class FirebaseInstanceIdService location: package com.google.firebase.iid
My AndroidManifest.xml is
<service android:name="com.atmajaa.atmajaabooks.services.MyFirebaseMessagingService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name="com.atmajaa.atmajaabooks.services.MyFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
Upvotes: 0
Views: 427
Reputation: 3732
FirebaseInstanceIdService
is deprecated ages ago. It is replaced with FirebaseMessagingService
. You're facing that error because latest Firebase libraries don't contain that class anymore.
As the documentation of FirebaseInstanceIdService here states,
This class is deprecated. In favour of overriding onNewToken in FirebaseMessagingService. Once that has been implemented, this service can be safely removed.
You can find how to migrate to FirebaseMessagingService
below
FirebaseInstanceIdService is Deprecated.
Upvotes: 1