Notification System

Quasar Smartphone PRO includes two types of notification, simple notification or notification from the Dynamic Island, here you will understand how to execute both.

Don't forget that you have example files inside client/custom/example.lua and server/custom/example.lua, there we leave many useful snippets and how to use them.

In this document you will learn everything about the dynamic notification system that Quasar Smartphone PRO includes. This system includes two types of notifications, simple notification and notification from the Dynamic Island, with this you can create a multitude of unique systems.

Is there any difference between these notifications?

There is no difference, just visual.

Can I use the notifications from the old Smartphone?

Yes, of course, the old Smartphone events will work as a simple notification here.

What happens to Lockscreen notifications?

These work automatically from now on, just add the notification event and it will appear.


Basic pop-up notification

Smartphone PRO detects the app name and uses its image as an icon automatically, it does not require giving it an image value.

The notification system in this version of Smartphone is more complex and configurable, since now we will have the new disableBadge value, this will serve to enable or disable the red notification on the application icon. In the case of the server side, we will have to detail the phone number using the GetPhoneNumberFromIdentifier export, unfold the sections and we will teach you the basic use of this system.

Client-side integration
-- Its same as the old one
RegisterCommand('notifiOld', function(source)
    exports['qs-smartphone-pro']:SendTempNotificationOld({
        title = 'Test',
        text = 'This is a test notification.',
        app = 'settings',
        timeout = 5000,
        disableBadge = true, -- Disables the badge on the app icon.
    })
end, false)
Server-side integration

This integration is more advanced and we will use the phone number to send it.

-- This export sends a basic notification to a phone number.
RegisterCommand('sendNewNotification', function(source, args)
    local phone = exports['qs-smartphone-pro']:GetPhoneNumberFromIdentifier(GetPlayerIdentifier(source), false)
    local disableTempNotification = false -- Disables the temporary notification. (Pop up notification)
    exports['qs-smartphone-pro']:sendNotificationOld(phone, {
        app = 'twitter',
        msg = 'Hello world!',
        head = 'Quasar'
    }, disableTempNotification)
end, false)

Pop-up notification on Dynamic Island

This system will work in the same way as the basic notification but we will leave a mini user guide so you know how to export it correctly.

In this case it will be as in the previous one, you can use the example to understand the function.

Client-side integration
-- Example of how to use the notification function.
RegisterCommand('notifi', function(source)
    exports['qs-smartphone-pro']:SendTempNotification({
        title = 'Test',
        text = 'This is a test notification.',
        app = 'settings',
        timeout = 5000,
        disableBadge = true, -- Disables the badge on the app icon.
    })
end, false)
Server-side integration

This integration is more advanced and we will use the phone number to send it.

-- This export sends a new notification to a phone number.
RegisterCommand('sendNewNotification', function(source, args)
    local phone = exports['qs-smartphone-pro']:GetPhoneNumberFromIdentifier(GetPlayerIdentifier(source), false)
    local disableTempNotification = false -- Disables the temporary notification. (Pop up notification)
    exports['qs-smartphone-pro']:sendNotification(phone, {
        app = 'twitter',
        msg = 'Hello world!',
        head = 'Quasar'
    }, disableTempNotification)
end, false)

Last updated