Firebase Cloud Messaging without google-services.json file

The default way to initialize Firebase in your Android app is to use the google-services.json file you can download from the firebase console. The content of this file will be automatically merged by gradle to initialize the FirebaseApp instance for your app.

To manually initialize a FirebaseApp app, you can do the following (I replaced the real values with the key structure of the google-services.json file):

FirebaseOptions options = new FirebaseOptions.Builder()

FirebaseApp app = FirebaseApp.initializeApp(getApplicationContext(), options);

String token = FirebaseInstanceId.getInstance().getToken();