I'm connecting fcm to my Android app and I have followed the documentation completely but I think I might be missing something.
I've tried reinstalling the app multiple times to try to hit onTokenRefresh()
and it doesn't work.
I also tried sending a push notification through the Firebase portal and it never arrived.
So maybe it's something with my setup although I believe I have everything setup correctly.
I added this to the project level gradle:
classpath 'com.google.gms:google-services:4.0.0'
App level gradle:
compile 'com.google.firebase:firebase-core:16.0.0'
compile 'com.google.firebase:firebase-messaging:17.0.0'
And outside of the app level gradle dependencies tag
apply plugin: 'com.google.gms.google-services'
My Android Manifest also has the following services
<service android:name=".fcm.SEFirebaseInstanceIDService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT"/>
</intent-filter>
</service>
<service android:name=".fcm.SEMessagingService"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"/>
</intent-filter>
</service>
Yes, my Android manifest entries are before the </application>
I've reviewed every single StackOverflow post regarding this issue and all of them are solved by small mistakes in the implementation that I'm not making.
Please help!
edit:
My very simple class to catch changes in the token is here
public class SEFirebaseInstanceIDService extends FirebaseInstanceIdService {
private static final String TAG = SEFirebaseInstanceIDService.class.getSimpleName();
@Override
public void onTokenRefresh() {
super.onTokenRefresh();
String refreshedToken = FirebaseInstanceId.getInstance().getToken();
Log.e("token",""+refreshedToken);
}
}
The main goal is being able to send notifications properly but I'm assuming that not reaching onTokenRefresh
is the root of being unable to send a notification.