Receiving multiple notifications through a process called page stacking
In the previous sections, we have looked at how we can use notifications to send basic and customized notifications to our Android wearable device. In the final section, we will look at how we can use our notification service to group notifications through a process called page stacking.
This process helps us to intelligently collate and bundle similar items within a single collection to provide us with easy navigation from the same app. So, let's get started:
- Open the
MainActivity.java
file from within our Project Navigator window. - Modify the
onCreate(Bundle savedInstanceState)
method and add the following highlighted code:@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Clear all previous notifications and // generate new unique ids NotificationManagerCompat.from(this).cancelAll...