Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
android:value=".MainActivity" />
</activity>

<!-- TODO (5) Add your new service here, with an intent filter for action
com.google.firebase.INSTANCE_ID_EVENT" -->

</application>

</manifest>
18 changes: 16 additions & 2 deletions app/src/main/java/android/example/com/squawker/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -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


}

Expand Down