diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 39412b52..29ce1f00 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -33,6 +33,9 @@ android:value=".MainActivity" /> + + \ No newline at end of file diff --git a/app/src/main/java/android/example/com/squawker/MainActivity.java b/app/src/main/java/android/example/com/squawker/MainActivity.java index 5abffe75..0bb93f23 100644 --- a/app/src/main/java/android/example/com/squawker/MainActivity.java +++ b/app/src/main/java/android/example/com/squawker/MainActivity.java @@ -86,8 +86,22 @@ protected void onCreate(Bundle savedInstanceState) { // Start the loader getSupportLoaderManager().initLoader(LOADER_ID_MESSAGES, null, this); - // TODO (1) Get the test data here from the extras bundle that came with this intent. - // To confirm that the data was passed in, make sure to show the data in a log statement. + // Gets the extra data from the intent that started the activity. For *notification* + // messages, this will contain key value pairs stored in the *data* section of the message. + Bundle extras = getIntent().getExtras(); + // Checks if the extras exist and if the key "test" from our FCM message is in the intent + if (extras != null && extras.containsKey("test")) { + // If the key is there, print out the value of "test" + Log.d(LOG_TAG, "Contains: " + extras.getString("test")); + } + + // TODO (1) Make a new package for your FCM service classes called "fcm" + // TODO (2) Create a new Service class that extends FirebaseInstanceIdService. + // You'll need to implement the onTokenRefresh method. Simply have it print out + // the new token. + // TODO (3) Here, in MainActivity, get a token using FirebaseInstanceId.getInstance().getToken() + // TODO (4) Get the message from that token and print it in a log statement + }