[PAID] OneSignalPush: Implement push notifications using OneSignal SDK ($10 or INR 701)

OneSignalPush Extension

This extension ships with one of the most stable One Signal SDK which is (4.8.7) . You can easily receive push notifications sent from OneSignal dashboard in your app. You can send notifications to all subs and individuals. You can send a customized notification also.

1. Overview

LatestVersion: 1
Released: 2024-04-29T18:30:00Z
Last Updated: 2024-04-29T18:30:00Z
Permissions: android.permission.ACCESS_NETWORK_STATE , android.permission.POST_NOTIFICATIONS

Aix Size: 1.1mb

2. Blocks

image

3. Documentation

Events

GotAllTagsEvent raised after getting user's tags
tagDictionary | dictionary
NotificationOpenedEvent raised when user opens notification by clicking on it while app is in foreground
id | number
data | text
NotificationReceivedEvent raised when a notification is received
id | number
data | text
ActionButtonClickedEvent raised when user opens notification by clicking Action Button
id | number
actionId | text
data | text
SubscriptionChangedEvent raised when subscription state changes
isSubscribed | boolean
userId | text
pushToken | text
PermissionStateChangedEvent raised when notification permission state changes
isGranted | boolean
NotificationSentEvent raised when notification was sent successfully
NotificationSendFailedEvent raised when notification sending failed
errorMsg | text

Methods

InitializeInitialize OneSignal sdk with specified App Id
appId | text
ClearNotificationClears notifications with specified id
id | number
ClearAllNotificationsClears all notifications posted by OneSignal
RemoveExternalIdRemoves user's external id
AskPermissionAsks for Notification permission in Android 13 and above
IsSubscribedReturns user's subscription status
EnablePushEnable Push notifications
DisablePushDisable Push notifications
GetUserIdReturns user id
GetPushTokenReturns push token
AddTagAdd tag to user
tag | text
value | text
RemoveTagRemove tag from user
tag | text
SetExternalIdSets current user's external id
id | text
GetAllTagsFetches user's all tags from OneSignal
IsPermissionGrantedReturns whether notification permission has been granted or not
RetrieveBackgroundNotifsRetrieve all cached notifications which were received when app was closed
ClearBackgroundNotifsClears all cached notifications
SendToAllSubscribersSend notification to all subscribed users
apiKey | text
appId | text
title | text
body | text
largeIcon | text
data | dictionary
SendToSubsIDsSend notification to all specified User Ids
apiKey | text
appId | text
ids | list
title | text
body | text
largeIcon | text
data | text
SendCustomNotifSend custom notification
apiKey | text
jsonString | text

Properties

EmailSets user email
Property Type : write-only
Accepts : text
SmsNumberSets user phone number
Property Type : write-only
Accepts : text
SmallIcon
Property Type : write-only
Accepts : text

4. Usages

Initialize OneSignal sdk

Ask for Notification Permission (will be asked only on Android 13 and above versions
image

Then Enable Push Notifications i.e. Subscribe User
image

Subscription State will be changed after EnablePush method

Now you can send Push Notifications

Set custom Small Icon
image
Custom icon can be set only from assets
You can generate small here from here
Requires Android Marshamallow (Api 23)

5. Demo Video and Images

Android 14

6. Purchase Extension

Thank you.
Hope it helps!

2 Likes