I have followed the firebase documentation cloud messaging for android https://firebase.google.com/docs/android/setup
Followed these steps :
- Created project on firebase
- downloaded google-services.json and added it in project
Added below services in manifest file : MyFirebaseInstanceIDService
<service android:name=".Service.MyFirebaseInstanceIDService"> <intent-filter> <action android:name="com.google.firebase.INSTANCE_ID_EVENT" /> </intent-filter> </service>MyFirebaseMessagingService
<service android:name=".Service.MyFirebaseMessagingService"> <intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT"/> </intent-filter>Added meta data in manifest file :
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@drawable/ic_launcher" /> <meta-data android:name="com.google.firebase.messaging.default_notification_color" android:resource="@color/colorAccent" />I am getting the registration token through
FirebaseInstanceId.getInstance().getToken()
and also added onRefreshToken()
Still I am not getting the notification from firebase console.