1-After completing integration with Sdk detailed in this link Android SDK Integration
2-Add these dependencies to your build.gradle App level:
compile 'com.android.support:recyclerview-v7:25.0.0'
3-After syncing the project Add RecyclerView to your activity layout:
<android.support.v7.widget.RecyclerView
android:id="@+id/mainRecycler"
android:layout_width="match_parent"
android:layout_height="match_parent" />
4-Inside onCreate() of your activity registerForRemoteNotifications and set CustomHandler class to receive incoming data:
Pushbots.sharedInstance().setCustomHandler(customHandler.class);
Pushbots.sharedInstance().registerForRemoteNotifications();
5-Handle incoming data inside CustomHandler class onReceive() method save the data to your database:
if (action.equals(PBConstants.EVENT_MSG_RECEIVE)) {
Database database = new Database(context);
database.insertNotificationData(intent.getBundleExtra(PBConstants.EVENT_MSG_RECEIVE));
}
6-Attach the adapter to your RecyclerView onStart():
NotificationAdapter notificationAdapter = new NotificationAdapter(this, database.readNotificationData());
notificationAdapter.notifyDataSetChanged();
notificationsRecycler.setAdapter(notificationAdapter);
Looks confusing? checkout our sample app Notifications History