OneSignalPush Extension
This extension ships with latest OneSignal SDK (5.1.17) . You can easily receive push notifications sent from OneSignal dashboard or from blocks in your app. You can send notifications to all subs and individuals. You can send a customized notification also.1. Overview
Latest Version: 2
Released: 2024-04-29T18:30:00Z
Last Updated: 2024-07-18T18:30:00Z
Permissions: android.permission.ACCESS_NETWORK_STATE
, android.permission.POST_NOTIFICATIONS
Aix Size: 2.9mb
2. Blocks
3. Documentation
Methods:
AddUserEmail
Adds user email address
Parameter | Type |
---|---|
text |
RemoveUserEmail
Removes user email address
Parameter | Type |
---|---|
text |
AddUserPhone
Adds user phone number
Parameter | Type |
---|---|
phone | text |
RemoveUserPhone
Removes user phone number
Parameter | Type |
---|---|
phone | text |
Initialize
Initialize OneSignal SDK with specified App Id
Parameter | Type |
---|---|
appId | text |
ClearNotification
Clears notifications with specified id
Parameter | Type |
---|---|
id | number |
ClearAllNotifications
Clears all notifications posted by OneSignal
AskPermission
Asks for Notification permission in Android 13 and above
IsPermissionGranted
Returns whether notification permission has been granted or not
Return Type: boolean
IsInitialized
Returns whether OneSignal has been initialized or not
Return Type: boolean
Login
Login with given user id. It has no effect on Push Notifications.
Parameter | Type |
---|---|
userId | text |
GetUserId
Returns user (external) id set using ‘Login’ block
Return Type: text
GetSubscriptionId
Returns subscription id which is generated by OneSignal
Return Type: text
GetPushToken
Returns push token
Return Type: text
AddTag
Add tag to user
Parameter | Type |
---|---|
tag | text |
value | text |
RemoveTag
Remove tag from user
Parameter | Type |
---|---|
tag | text |
GetAllTags
Fetches user’s all tags from OneSignal
EnablePush
Enable Push notifications
DisablePush
Disable Push notifications
IsSubscribed
Returns user’s subscription status
Return Type: boolean
LogOut
Logs out current user. It has no effect on Push Notifications.
RetrieveBackgroundNotifs
Retrieve all cached notifications which were received when app was closed
Return Type: dictionary
ClearBackgroundNotifs
Clears all cached notifications
SendToAllSubscribers
Send notification to all subscribed users
Parameter | Type |
---|---|
apiKey | text |
appId | text |
title | text |
body | text |
largeIcon | text |
data | dictionary |
SendToSubsIDs
Send notification to all specified Subscriber Ids
Parameter | Type |
---|---|
apiKey | text |
appId | text |
ids | list |
title | text |
body | text |
largeIcon | text |
data | text |
SendCustomNotif
Send custom notification
Parameter | Type |
---|---|
apiKey | text |
jsonString | text |
Events:
GotAllTags
Event raised after getting user’s tags
Parameter | Type |
---|---|
tagDictionary | dictionary |
NotificationSent
Event raised when notification was sent successfully
NotificationSendFailed
Event raised when notification sending failed
Parameter | Type |
---|---|
errorMsg | text |
PermissionStateChanged
Event raised when notification permission state changes
Parameter | Type |
---|---|
isGranted | boolean |
NotificationOpened
Event raised when user opens notification by clicking on it while app is in foreground
Parameter | Type |
---|---|
id | number |
data | text |
NotificationReceived
Event raised when a notification is received
Parameter | Type |
---|---|
id | number |
data | text |
ActionButtonClicked
Event raised when user opens notification by clicking Action Button
Parameter | Type |
---|---|
id | number |
actionId | text |
data | text |
SubscriptionChanged
Event raised when subscription state changes
Parameter | Type |
---|---|
isSubscribed | boolean |
subscriptionId | text |
pushToken | text |
Properties:
SdkVersion
Returns OneSignal SDK version
Language
Sets user language
SmallIcon
Sets small icon (from Assets) to be used in notification
UseBigPicture
Uses largeIcon as Big Picture in notification sent using blocks
4. Usages
Initialize OneSignal sdk
Ask for Notification Permission (will be asked only on Android 13 and above versions
Then Enable Push Notifications i.e. Subscribe User
Subscription State will be changed after EnablePush method
Now you can send Push Notifications
Set custom Small Icon
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!