These docs are for v1.0. Click to read the latest docs for v2.0.

Notification Center

Notification center allows you to show delivered push notifications sent from Smartech inside your app so that users can access it any time they want.

Integrate the Notification center into the App

To use the Notification Center feature in your app, download the files from Github and follow the steps mentioned below:

1. Add given dependencies in the build.gradle file of your app.

implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.github.bumptech.glide:glide:4.9.0'

2. Copy notification centre related layout file in the resource layout folder

  • activity_notification_center.xml
  • carousal_item.xml
  • Notification_row.xml

3. Paste Activity & Adapter classes inside the project

  • NotificationCenterActivity.class
  • CarousalAdapter.class
  • NotificationAdapter.class

4. Paste below code in AndroidManifest.xml file of the application

<activity
    android:theme="@style/Theme.AppCompat.Light.NoActionBar"
    android:name=".activity.NotificationCenterActivity" />

Fetch Delivered Push Notifications

To fetch delivered push notifications, add snippet given below. The method returns a JSONArray of delivered push notifications for the user. ​By default, the method returns last 10 delivered notifications​​.

JSONArray notifications = NetcoreSDK.getNotifications(context);
                          OR
JSONArray notifications = NetcoreSDK.getNotifications(context, <count>);

Fetch Unread Push Notification Count

To fetch unread push notification count from the NetcoreSDK, add given snippet as per the requirement.

int count = NetcoreSDK.getUnreadNotificationsCount(context);