It's my first time using FCM.
I download a sample from firebase/quickstart-android and I install the FCM Quickstart. But I can't get any token from the log even hit the LOG TOKEN button in the app.
Then I try to send a message with Firebase console and set to target my app package name. I got incoming messages.
I want to know can FCM be used?GCM everything is ok.
Solution:
Because I am not an Android developer, just a backend developer. So it takes me some time to solve it. In my opinion, there`re some bugs in the sample app.
Code:
RegistrationIntentService.java
public class RegistrationIntentService extends IntentService {
    private static final String TAG = "RegIntentService";
    public RegistrationIntentService() {
        super(TAG);
    }
    @Override
    protected void onHandleIntent(Intent intent) {
        String token = FirebaseInstanceId.getInstance().getToken();
        Log.i(TAG, "FCM Registration Token: " + token);
    }
}
MyFirebaseInstanceIDService.java
public class MyFirebaseInstanceIDService extends FirebaseInstanceIdService {
    private static final String TAG = "MyFirebaseIIDService";
    /**
     * Called if InstanceID token is updated. This may occur if the security of
     * the previous token had been compromised. Note that this is called when the InstanceID token
     * is initially generated so this is where you would retrieve the token.
     */
    // [START refresh_token]
    @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);
//
        Intent intent = new Intent(this, RegistrationIntentService.class);
        startService(intent);
    }
    // [END refresh_token]
    /**
     * Persist token to third-party servers.
     * <p>
     * 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.
    }
}
Add this in the MainActivity.java.
 Intent intent = new Intent(this, RegistrationIntentService.class);
        startService(intent);
After do above,you get the Token in Logcat. But finally, I find a convenient way to get it.Just use debug mode to install the sample app and you can get the token when you first time to install it.
But I don't know why it can't print the log when I install it. Maybe be related to the mobile system.
And then why I can't get the Notification. FirebaseMessagingService.onMessageReceived did not call sendNotification
