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 = Smartech.getInstance(new WeakReference<Context>(context)).getNotifications(<count>);
val notifications: JSONArray = Smartech.getInstance(WeakReference(context)).getNotifications(<count>)

Fetch Unread Push Notification Count

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

int count = Smartech.getInstance(new WeakReference<Context>(context)).getUnreadNotificationsCount(context);
val count:Int = Smartech.getInstance(WeakReference(context)).getUnreadNotificationsCount(context)

Delete Notification

To delete notification received on device use deleteNotification() method.

Smartech.getInstance(new WeakReference<Context>(context)).deleteNotification(context,tridList);
Smartech.getInstance(WeakReference(context)).deleteNotification(context,tridList)