A library to receive and show notification for Android.

Overview

Basalam Notification

A library to receive and show notiffication for Android.

  • Register or unregister user to your server.
  • Receive Notifictation per 15 minutes.
  • Show notification as soon as received.
  • Handle on notification click.

Download

Add the package dependencies to your build.gradle file:

    dependencies {
       implementation 'com.basalam.notificationmodule:notification:1.0.2'
    }

Add the repository to your build.gradle file:

repositories {
    maven {
            url = uri("https://maven.pkg.github.com/basalam/notification")
        }
}

How to use

Your application class:

@HiltAndroidApp
class App : Application(), Configuration.Provider {

    @Inject
    lateinit var workerFactory: HiltWorkerFactory

    override fun getWorkManagerConfiguration(): Configuration =
        Configuration.Builder()
            .setMinimumLoggingLevel(android.util.Log.INFO)
            .setWorkerFactory(workerFactory)
            .build()
}

add App to manifest:

        android:name=".App"

Your MainActivity class:

        @Inject
        lateinit var notificationCore: NotificationCore

To init library:

        notificationCore.init(application = application, owner = this)

To Create Worker:

        notificationCore.createWorker(
            application,
            token = "token",
            endPoint = "https://example.basalam.com/api/api_v1.0/notifications/",
            deviceId = "test",
            notificationImage = R.drawable.basalam,
            notificationPackageName = "com.basalam.notification",
            notificationClassPackageName = "com.basalam.notification.MainActivity"
        )

To cancel Worker:

        notificationCore.cancelWorker(application)

To register user:

        notificationCore.registerUser(
            token = "token",
            endPoint = "https://example.basalam.com/api/api_v1.0/notifications/register",
            deviceId = "test",
            isCustomerApp = true
        )

To unregister user:

        notificationCore.unregisterUser(
            token = "token",
            endPoint = "https://example.basalam.com/api/api_v1.0/notifications/unregister",
            deviceId = "test",
            isCustomerApp = true
        )

To handle on notification click:

    override fun onResume() {
        super.onResume()
        checkIntent(intent)
    }

    private fun checkIntent(intent: Intent?) {
        intent?.let {
            if (it.hasExtra(NotificationCore.NOTIFICATION_EXTRA)) {
                val endPoint = it.getStringExtra(NotificationCore.NOTIFICATION_CLICK_ENDPOINT)
                val id = it.getStringExtra(NotificationCore.NOTIFICATION_ID)

                if (endPoint != null && id != null) {
                    notificationCore.clickedOnNotification(
                        endPoint = endPoint,
                        token = "token",
                        id = id
                    )
                }
            }
        }
    }
You might also like...
 AvengersChat is a demo application based on modern Android tech stacks and Stream Chat SDK.
AvengersChat is a demo application based on modern Android tech stacks and Stream Chat SDK.

๐Ÿ’™ Android sample Avengers chat application using Stream Chat SDK based on MVVM (ViewModel, Coroutines, Room, Hilt, Repository) architecture.

Android app to search for artists, albums or tracks and get a list of related songs using the iTunes Searcher API.
Android app to search for artists, albums or tracks and get a list of related songs using the iTunes Searcher API.

iTunes Searcher Android app to search for artists, albums or tracks and get a list of related songs using the iTunes Searcher API. Each song may be cl

Qiscus provide everything you need to power up your app with chats. And it's now made simple.
Qiscus provide everything you need to power up your app with chats. And it's now made simple.

Introduction Qiscus Chat SDK (Software Development Kit) is a product provided by Qiscus that enables you to embed an in-app chat/chat feature in your

NekoX is an free and open source third-party Telegram client, based on Telegram-FOSS with features added.

NekoX NekoX is an free and open source third-party Telegram client, based on Telegram-FOSS with features added. We are no longer able to update versio

Jitsi Meet - Secure, Simple and Scalable Video Conferences

Jitsi Meet is an open-source (Apache) WebRTC JavaScript application that uses Jitsi Videobridge to provide high quality, secure and scalable video conferences.

Talkufy brings you everything you need. From chatting, video calling (Beta), translating messages, group chats and lots more.
Talkufy brings you everything you need. From chatting, video calling (Beta), translating messages, group chats and lots more.

Talkufy A highly advanced and encrypted open source featured chat/video calling app for android using Firebase Firestore and Jitsi Meet. With this app

This app includes Implementation of Huawei and Google Kits in a single codebase using Build Variants. ๐Ÿ—บ ๐Ÿ“ฉ
This app includes Implementation of Huawei and Google Kits in a single codebase using Build Variants. ๐Ÿ—บ ๐Ÿ“ฉ

Build Variant App ๐Ÿ—พ ๐Ÿ“ฆ ๐Ÿ“ฑ Build variant is a feature of Android Studio to create a project which can be build in different versions. By using Build V

This is a Bluetooth operational Chat-App developed using Kotlin which shows the list of available devices nearby and paired devices, upon clicking you can start chat
This is a Bluetooth operational Chat-App developed using Kotlin which shows the list of available devices nearby and paired devices, upon clicking you can start chat

This is a Bluetooth operational Chat-App developed using Kotlin which shows the list of available devices nearby and paired devices, upon clicking you can start chat ... VOILA ๐Ÿฅณ๐Ÿฅณ It is still in its early stages of development and currently let user to one-time chat at a time. It is under heavy development ๐Ÿ˜…

Chat App is built to demonstrate a simple end-to-end chat encryption using RSA and AES algorithms
Chat App is built to demonstrate a simple end-to-end chat encryption using RSA and AES algorithms

End-to-End Encrypted Chat ๐Ÿ”’ Chat App is built to demonstrate a simple end-to-end chat encryption using RSA and AES algorithms Built With โš’๏ธ Jetpack C

Owner
Basalam
Basalam
NotiNotes - A simple Notes app for Android which only lives in your QS and notification panel

NotiNotes The Notes app for your notification panel. A simple Notes app for Andr

Yann 25 Dec 11, 2022
Notification - Notifications provide short, timely information about events in your app while it's not in use

Notification โญ Notifications provide short, timely information about events in y

BEYZANUR AKKUZU 1 Jan 13, 2022
A simple library for creating animated warnings/dialogs/alerts for Android.

Noty A simple library for creating animated warnings/notifications for Android. Examples Show me code Show me code Show me code Show me code Show me c

Emre 144 Nov 29, 2022
Android Combined Application for chat, audio/video calls, and broadcast to millions of web and app users using VdoTok SDK.

Android Combined Application for chat, audio/video calls, and broadcast to millions of web and app users using VdoTok SDK.

VdoTok 3 Nov 22, 2022
Quick Text is about send the message on WhatsApp without saving number. You can see the status of other and share and download those status also.

Quick Text is about send the message on WhatsApp without saving number. You can see the status of other and share and download those status also.

Dheeraj Gupta 11 May 25, 2022
Messaging API: Connect to PostgreSQL and Kafka to obtain and manage cars inventory

Messaging-API In this simple API, we connect to PostgreSQL and Kafka to obtain a

Kevork 0 Feb 18, 2022
A simple video calling application uses Firebase database and WebRTC API that enables you Peer-to-Peer Full-HD video and audio connection.

A simple video calling application uses Firebase database and WebRTC API that enables you Peer-to-Peer Full-HD video and audio connection.

Indrajit Sahu 10 Sep 27, 2022
Android has a built in microphone through which you can capture audio and store it , or play it in your phone. There are many ways to do that but with this dialog you can do all thats with only one dialog.

# Media Recorder Dialog ![](https://img.shields.io/badge/Platform-Android-brightgreen.svg) ![](https://img.shields.io/badge/Android-CustomView-blue.sv

Abdullah Alhazmy 73 Nov 29, 2022
Open Source Messenger App For Android - Real-time Messaging, Voice and Video Calls

Open Source Messenger App For Android - Real-time Messaging, Voice and Video Calls

mesibo 630 Dec 7, 2022
A hybrid chat android application based on the features of Instagram and Whatsapp having UI just as Telegram.

A hybrid chat android application based on the features of Instagram and Whatsapp having UI just as Telegram.

Ratik Tiwari 1 May 22, 2022