Android Firebase Push Notification not received











up vote
0
down vote

favorite












I followed the tutorial from this link http://blog.nkdroidsolutions.com/android-push-notification-example-using-firebase/ but I am not not receiving any notification on my device.



I checked and tried these links too, but could not find a solution
android - Firebase Notification Push Notification not working
Push Notification not Received in android



In my firebase console, the notification sent is 0. Here is my androidManifest File



 <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ather.healthapp">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WIFI" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

<activity android:name=".MainActivity" />
<activity android:name=".LoginActivity" />
<activity android:name=".SplashScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SignUpScreen">
<intent-filter>
<action android:name="com.example.ather.healthapp.SignUpScreen" />

<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>



<activity android:name=".LoginActivity_New" />
<activity android:name=".ActivityUserProfile" />

<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

<activity
android:name=".MapActivity"
android:label="@string/title_activity_map" />
<activity android:name=".TestActivity" />
<activity android:name=".stDisplayListView" />
<activity android:name=".DoctorAppointment" />
<activity android:name=".todelete" />
<activity android:name=".TestGoogleSignIn" />
<activity android:name=".UserHistoryActivity" />
<activity android:name=".UserMedicineAndTestActivity" />

<service android:name="firebaseconnection.FirebaseIDService"
android:enabled="true"
android:exported="true"
>
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<service android:name="firebaseconnection.MyFirebaseMessagingService"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"

/>
</intent-filter>
</service>

<activity android:name=".UserTestAndMedicine"></activity>
</application>




The gradle file is as follows



apply plugin: 'com.android.application'


android {
compileSdkVersion 24
buildToolsVersion "24.0.0"

defaultConfig {
applicationId "com.example.ather.healthapp"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}

}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile project(path: ':volley')
repositories {
mavenCentral()
}
// this line must be included to integrate with Firebase
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.jakewharton:butterknife:8.1.0'
compile 'com.google.android.gms:play-services-auth:9.6.1'
compile 'com.google.android.gms:play-services:9.6.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.sothree.slidinguppanel:library:3.0.0'
compile 'com.android.support:design:24.2.1'
compile 'com.google.firebase:firebase-core:9.6.1'
compile 'com.google.firebase:firebase-messaging:9.6.1'
}

apply plugin: 'com.google.gms.google-services'


Firebase Messaging Service file



package FirebaseConnection;

import android.util.Log;

import com.google.firebase.messaging.RemoteMessage;
public class FirebaseMessagingService extends
com.google.firebase.messaging.FirebaseMessagingService {
private static final String TAG = "FCM Service";
@Override
public void onMessageReceived(RemoteMessage remoteMessage)
{
Log.d(TAG, "From: " + remoteMessage.getFrom());

// Check if message contains a data payload.
if (remoteMessage.getData().size() > 0) {
Log.d(TAG, "Message data payload: " + remoteMessage.getData());
}

// Check if message contains a notification payload.
if (remoteMessage.getNotification() != null) {
Log.d(TAG, "Message Notification Body: " + remoteMessage.getNotification().getBody());
}

}

}


And the Firebase ID Service



package FirebaseConnection;

import android.util.Log;

import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.iid.FirebaseInstanceIdService;

public class FirebaseIDService extends FirebaseInstanceIdService {
private static final String TAG = "FirebaseIDService";

@Override
public void onTokenRefresh() {
// Get updated InstanceID token.
String refreshedToken = FirebaseInstanceId.getInstance().getToken();
Log.d(TAG, "Refreshed token: " + refreshedToken);

// TODO: Implement this method to send any registration to your app's servers.
sendRegistrationToServer(refreshedToken);
}

/**
* Persist token to third-party servers.
*
* Modify this method to associate the user's FCM InstanceID token with any server-side account
* maintained by your application.
*
* @param token The new token.
*/
private void sendRegistrationToServer(String token) {
// Add custom implementation, as needed.
}
}


Any help would be appreciated.



Regards










share|improve this question
























  • Can you share MyFirebaseMessageService and FirebaseIDService class code?
    – rogerwar
    Jan 7 '17 at 15:28










  • Are you getting any exception?
    – rogerwar
    Jan 7 '17 at 15:29










  • Do you have any data along with your notification? Please post the message you send as your notification.
    – Reaz Murshed
    Jan 7 '17 at 15:35










  • There is no exception, and we are sending it though firebase console a simple hello message with no data
    – AIS
    Jan 8 '17 at 8:47










  • @rogerwar Added files as suggested.
    – AIS
    Jan 8 '17 at 8:53















up vote
0
down vote

favorite












I followed the tutorial from this link http://blog.nkdroidsolutions.com/android-push-notification-example-using-firebase/ but I am not not receiving any notification on my device.



I checked and tried these links too, but could not find a solution
android - Firebase Notification Push Notification not working
Push Notification not Received in android



In my firebase console, the notification sent is 0. Here is my androidManifest File



 <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ather.healthapp">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WIFI" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

<activity android:name=".MainActivity" />
<activity android:name=".LoginActivity" />
<activity android:name=".SplashScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SignUpScreen">
<intent-filter>
<action android:name="com.example.ather.healthapp.SignUpScreen" />

<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>



<activity android:name=".LoginActivity_New" />
<activity android:name=".ActivityUserProfile" />

<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

<activity
android:name=".MapActivity"
android:label="@string/title_activity_map" />
<activity android:name=".TestActivity" />
<activity android:name=".stDisplayListView" />
<activity android:name=".DoctorAppointment" />
<activity android:name=".todelete" />
<activity android:name=".TestGoogleSignIn" />
<activity android:name=".UserHistoryActivity" />
<activity android:name=".UserMedicineAndTestActivity" />

<service android:name="firebaseconnection.FirebaseIDService"
android:enabled="true"
android:exported="true"
>
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<service android:name="firebaseconnection.MyFirebaseMessagingService"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"

/>
</intent-filter>
</service>

<activity android:name=".UserTestAndMedicine"></activity>
</application>




The gradle file is as follows



apply plugin: 'com.android.application'


android {
compileSdkVersion 24
buildToolsVersion "24.0.0"

defaultConfig {
applicationId "com.example.ather.healthapp"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}

}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile project(path: ':volley')
repositories {
mavenCentral()
}
// this line must be included to integrate with Firebase
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.jakewharton:butterknife:8.1.0'
compile 'com.google.android.gms:play-services-auth:9.6.1'
compile 'com.google.android.gms:play-services:9.6.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.sothree.slidinguppanel:library:3.0.0'
compile 'com.android.support:design:24.2.1'
compile 'com.google.firebase:firebase-core:9.6.1'
compile 'com.google.firebase:firebase-messaging:9.6.1'
}

apply plugin: 'com.google.gms.google-services'


Firebase Messaging Service file



package FirebaseConnection;

import android.util.Log;

import com.google.firebase.messaging.RemoteMessage;
public class FirebaseMessagingService extends
com.google.firebase.messaging.FirebaseMessagingService {
private static final String TAG = "FCM Service";
@Override
public void onMessageReceived(RemoteMessage remoteMessage)
{
Log.d(TAG, "From: " + remoteMessage.getFrom());

// Check if message contains a data payload.
if (remoteMessage.getData().size() > 0) {
Log.d(TAG, "Message data payload: " + remoteMessage.getData());
}

// Check if message contains a notification payload.
if (remoteMessage.getNotification() != null) {
Log.d(TAG, "Message Notification Body: " + remoteMessage.getNotification().getBody());
}

}

}


And the Firebase ID Service



package FirebaseConnection;

import android.util.Log;

import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.iid.FirebaseInstanceIdService;

public class FirebaseIDService extends FirebaseInstanceIdService {
private static final String TAG = "FirebaseIDService";

@Override
public void onTokenRefresh() {
// Get updated InstanceID token.
String refreshedToken = FirebaseInstanceId.getInstance().getToken();
Log.d(TAG, "Refreshed token: " + refreshedToken);

// TODO: Implement this method to send any registration to your app's servers.
sendRegistrationToServer(refreshedToken);
}

/**
* Persist token to third-party servers.
*
* Modify this method to associate the user's FCM InstanceID token with any server-side account
* maintained by your application.
*
* @param token The new token.
*/
private void sendRegistrationToServer(String token) {
// Add custom implementation, as needed.
}
}


Any help would be appreciated.



Regards










share|improve this question
























  • Can you share MyFirebaseMessageService and FirebaseIDService class code?
    – rogerwar
    Jan 7 '17 at 15:28










  • Are you getting any exception?
    – rogerwar
    Jan 7 '17 at 15:29










  • Do you have any data along with your notification? Please post the message you send as your notification.
    – Reaz Murshed
    Jan 7 '17 at 15:35










  • There is no exception, and we are sending it though firebase console a simple hello message with no data
    – AIS
    Jan 8 '17 at 8:47










  • @rogerwar Added files as suggested.
    – AIS
    Jan 8 '17 at 8:53













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I followed the tutorial from this link http://blog.nkdroidsolutions.com/android-push-notification-example-using-firebase/ but I am not not receiving any notification on my device.



I checked and tried these links too, but could not find a solution
android - Firebase Notification Push Notification not working
Push Notification not Received in android



In my firebase console, the notification sent is 0. Here is my androidManifest File



 <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ather.healthapp">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WIFI" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

<activity android:name=".MainActivity" />
<activity android:name=".LoginActivity" />
<activity android:name=".SplashScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SignUpScreen">
<intent-filter>
<action android:name="com.example.ather.healthapp.SignUpScreen" />

<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>



<activity android:name=".LoginActivity_New" />
<activity android:name=".ActivityUserProfile" />

<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

<activity
android:name=".MapActivity"
android:label="@string/title_activity_map" />
<activity android:name=".TestActivity" />
<activity android:name=".stDisplayListView" />
<activity android:name=".DoctorAppointment" />
<activity android:name=".todelete" />
<activity android:name=".TestGoogleSignIn" />
<activity android:name=".UserHistoryActivity" />
<activity android:name=".UserMedicineAndTestActivity" />

<service android:name="firebaseconnection.FirebaseIDService"
android:enabled="true"
android:exported="true"
>
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<service android:name="firebaseconnection.MyFirebaseMessagingService"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"

/>
</intent-filter>
</service>

<activity android:name=".UserTestAndMedicine"></activity>
</application>




The gradle file is as follows



apply plugin: 'com.android.application'


android {
compileSdkVersion 24
buildToolsVersion "24.0.0"

defaultConfig {
applicationId "com.example.ather.healthapp"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}

}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile project(path: ':volley')
repositories {
mavenCentral()
}
// this line must be included to integrate with Firebase
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.jakewharton:butterknife:8.1.0'
compile 'com.google.android.gms:play-services-auth:9.6.1'
compile 'com.google.android.gms:play-services:9.6.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.sothree.slidinguppanel:library:3.0.0'
compile 'com.android.support:design:24.2.1'
compile 'com.google.firebase:firebase-core:9.6.1'
compile 'com.google.firebase:firebase-messaging:9.6.1'
}

apply plugin: 'com.google.gms.google-services'


Firebase Messaging Service file



package FirebaseConnection;

import android.util.Log;

import com.google.firebase.messaging.RemoteMessage;
public class FirebaseMessagingService extends
com.google.firebase.messaging.FirebaseMessagingService {
private static final String TAG = "FCM Service";
@Override
public void onMessageReceived(RemoteMessage remoteMessage)
{
Log.d(TAG, "From: " + remoteMessage.getFrom());

// Check if message contains a data payload.
if (remoteMessage.getData().size() > 0) {
Log.d(TAG, "Message data payload: " + remoteMessage.getData());
}

// Check if message contains a notification payload.
if (remoteMessage.getNotification() != null) {
Log.d(TAG, "Message Notification Body: " + remoteMessage.getNotification().getBody());
}

}

}


And the Firebase ID Service



package FirebaseConnection;

import android.util.Log;

import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.iid.FirebaseInstanceIdService;

public class FirebaseIDService extends FirebaseInstanceIdService {
private static final String TAG = "FirebaseIDService";

@Override
public void onTokenRefresh() {
// Get updated InstanceID token.
String refreshedToken = FirebaseInstanceId.getInstance().getToken();
Log.d(TAG, "Refreshed token: " + refreshedToken);

// TODO: Implement this method to send any registration to your app's servers.
sendRegistrationToServer(refreshedToken);
}

/**
* Persist token to third-party servers.
*
* Modify this method to associate the user's FCM InstanceID token with any server-side account
* maintained by your application.
*
* @param token The new token.
*/
private void sendRegistrationToServer(String token) {
// Add custom implementation, as needed.
}
}


Any help would be appreciated.



Regards










share|improve this question















I followed the tutorial from this link http://blog.nkdroidsolutions.com/android-push-notification-example-using-firebase/ but I am not not receiving any notification on my device.



I checked and tried these links too, but could not find a solution
android - Firebase Notification Push Notification not working
Push Notification not Received in android



In my firebase console, the notification sent is 0. Here is my androidManifest File



 <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.ather.healthapp">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WIFI" />
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

<activity android:name=".MainActivity" />
<activity android:name=".LoginActivity" />
<activity android:name=".SplashScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".SignUpScreen">
<intent-filter>
<action android:name="com.example.ather.healthapp.SignUpScreen" />

<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>



<activity android:name=".LoginActivity_New" />
<activity android:name=".ActivityUserProfile" />

<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

<activity
android:name=".MapActivity"
android:label="@string/title_activity_map" />
<activity android:name=".TestActivity" />
<activity android:name=".stDisplayListView" />
<activity android:name=".DoctorAppointment" />
<activity android:name=".todelete" />
<activity android:name=".TestGoogleSignIn" />
<activity android:name=".UserHistoryActivity" />
<activity android:name=".UserMedicineAndTestActivity" />

<service android:name="firebaseconnection.FirebaseIDService"
android:enabled="true"
android:exported="true"
>
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
<service android:name="firebaseconnection.MyFirebaseMessagingService"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT"

/>
</intent-filter>
</service>

<activity android:name=".UserTestAndMedicine"></activity>
</application>




The gradle file is as follows



apply plugin: 'com.android.application'


android {
compileSdkVersion 24
buildToolsVersion "24.0.0"

defaultConfig {
applicationId "com.example.ather.healthapp"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}

}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile project(path: ':volley')
repositories {
mavenCentral()
}
// this line must be included to integrate with Firebase
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.jakewharton:butterknife:8.1.0'
compile 'com.google.android.gms:play-services-auth:9.6.1'
compile 'com.google.android.gms:play-services:9.6.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.sothree.slidinguppanel:library:3.0.0'
compile 'com.android.support:design:24.2.1'
compile 'com.google.firebase:firebase-core:9.6.1'
compile 'com.google.firebase:firebase-messaging:9.6.1'
}

apply plugin: 'com.google.gms.google-services'


Firebase Messaging Service file



package FirebaseConnection;

import android.util.Log;

import com.google.firebase.messaging.RemoteMessage;
public class FirebaseMessagingService extends
com.google.firebase.messaging.FirebaseMessagingService {
private static final String TAG = "FCM Service";
@Override
public void onMessageReceived(RemoteMessage remoteMessage)
{
Log.d(TAG, "From: " + remoteMessage.getFrom());

// Check if message contains a data payload.
if (remoteMessage.getData().size() > 0) {
Log.d(TAG, "Message data payload: " + remoteMessage.getData());
}

// Check if message contains a notification payload.
if (remoteMessage.getNotification() != null) {
Log.d(TAG, "Message Notification Body: " + remoteMessage.getNotification().getBody());
}

}

}


And the Firebase ID Service



package FirebaseConnection;

import android.util.Log;

import com.google.firebase.iid.FirebaseInstanceId;
import com.google.firebase.iid.FirebaseInstanceIdService;

public class FirebaseIDService extends FirebaseInstanceIdService {
private static final String TAG = "FirebaseIDService";

@Override
public void onTokenRefresh() {
// Get updated InstanceID token.
String refreshedToken = FirebaseInstanceId.getInstance().getToken();
Log.d(TAG, "Refreshed token: " + refreshedToken);

// TODO: Implement this method to send any registration to your app's servers.
sendRegistrationToServer(refreshedToken);
}

/**
* Persist token to third-party servers.
*
* Modify this method to associate the user's FCM InstanceID token with any server-side account
* maintained by your application.
*
* @param token The new token.
*/
private void sendRegistrationToServer(String token) {
// Add custom implementation, as needed.
}
}


Any help would be appreciated.



Regards







android firebase firebase-cloud-messaging






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 23 '17 at 10:30









Community

11




11










asked Jan 7 '17 at 15:03









AIS

92212




92212












  • Can you share MyFirebaseMessageService and FirebaseIDService class code?
    – rogerwar
    Jan 7 '17 at 15:28










  • Are you getting any exception?
    – rogerwar
    Jan 7 '17 at 15:29










  • Do you have any data along with your notification? Please post the message you send as your notification.
    – Reaz Murshed
    Jan 7 '17 at 15:35










  • There is no exception, and we are sending it though firebase console a simple hello message with no data
    – AIS
    Jan 8 '17 at 8:47










  • @rogerwar Added files as suggested.
    – AIS
    Jan 8 '17 at 8:53


















  • Can you share MyFirebaseMessageService and FirebaseIDService class code?
    – rogerwar
    Jan 7 '17 at 15:28










  • Are you getting any exception?
    – rogerwar
    Jan 7 '17 at 15:29










  • Do you have any data along with your notification? Please post the message you send as your notification.
    – Reaz Murshed
    Jan 7 '17 at 15:35










  • There is no exception, and we are sending it though firebase console a simple hello message with no data
    – AIS
    Jan 8 '17 at 8:47










  • @rogerwar Added files as suggested.
    – AIS
    Jan 8 '17 at 8:53
















Can you share MyFirebaseMessageService and FirebaseIDService class code?
– rogerwar
Jan 7 '17 at 15:28




Can you share MyFirebaseMessageService and FirebaseIDService class code?
– rogerwar
Jan 7 '17 at 15:28












Are you getting any exception?
– rogerwar
Jan 7 '17 at 15:29




Are you getting any exception?
– rogerwar
Jan 7 '17 at 15:29












Do you have any data along with your notification? Please post the message you send as your notification.
– Reaz Murshed
Jan 7 '17 at 15:35




Do you have any data along with your notification? Please post the message you send as your notification.
– Reaz Murshed
Jan 7 '17 at 15:35












There is no exception, and we are sending it though firebase console a simple hello message with no data
– AIS
Jan 8 '17 at 8:47




There is no exception, and we are sending it though firebase console a simple hello message with no data
– AIS
Jan 8 '17 at 8:47












@rogerwar Added files as suggested.
– AIS
Jan 8 '17 at 8:53




@rogerwar Added files as suggested.
– AIS
Jan 8 '17 at 8:53












1 Answer
1






active

oldest

votes

















up vote
0
down vote













The problem is the name of your class!



Manifest: MyFirebaseMessagingService

Service class: FirebaseMessagingService


the name of the two must be the same






share|improve this answer





















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f41522823%2fandroid-firebase-push-notification-not-received%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    The problem is the name of your class!



    Manifest: MyFirebaseMessagingService

    Service class: FirebaseMessagingService


    the name of the two must be the same






    share|improve this answer

























      up vote
      0
      down vote













      The problem is the name of your class!



      Manifest: MyFirebaseMessagingService

      Service class: FirebaseMessagingService


      the name of the two must be the same






      share|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        The problem is the name of your class!



        Manifest: MyFirebaseMessagingService

        Service class: FirebaseMessagingService


        the name of the two must be the same






        share|improve this answer












        The problem is the name of your class!



        Manifest: MyFirebaseMessagingService

        Service class: FirebaseMessagingService


        the name of the two must be the same







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 10 at 23:00









        Mike Brian Olivera

        3651513




        3651513






























             

            draft saved


            draft discarded



















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f41522823%2fandroid-firebase-push-notification-not-received%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Full-time equivalent

            さくらももこ

            13 indicted, 8 arrested in Calif. drug cartel investigation