OneSignalPush Extension
This extension ships with latest OneSignal SDK (5.1.23) . 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
LatestVersion: 2
Released: 2024-04-29T18:30:00Z
Last Updated: 2024-10-11T18:30:00Z
Permissions: android.permission.ACCESS_NETWORK_STATE
, android.permission.POST_NOTIFICATIONS
Aix Size: 2.9mb
2. Blocks
3. Documentation
Events
GotAllTags | Event raised after getting user's tagstagDictionary | dictionary |
NotificationSent | Event raised when notification was sent successfully |
NotificationSendFailed | Event raised when notification sending failederrorMsg | text |
PermissionStateChanged | Event raised when notification permission state changesisGranted | boolean |
NotificationOpened | Event raised when user opens notification by clicking on it while app is in foregroundid | number data | text |
NotificationReceived | Event raised when a notification is receivedid | number data | text |
ActionButtonClicked | Event raised when user opens notification by clicking Action Buttonid | number actionId | text data | text |
SubscriptionChanged | Event raised when subscription state changesisSubscribed | boolean subscriptionId | text pushToken | text |
Methods
AddUserEmail | Adds user email addressemail | text |
RemoveUserEmail | Removes user email addressemail | text |
AddUserPhone | Adds user phone numberphone | text |
RemoveUserPhone | Removes user phone numberphone | text |
Initialize | Initialize OneSignal SDK with specified App IdappId | text |
ClearNotification | Clears notifications with specified idid | 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 |
IsInitialized | Returns whether OneSignal has been initialized or not |
Login | Login with given user id. It has no effect on Push Notifications.userId | text |
GetUserId | Returns user (external) id set using 'Login' block |
GetSubscriptionId | Returns subscription id which is generated by OneSignal |
GetPushToken | Returns push token |
AddTag | Add tag to usertag | text value | text |
RemoveTag | Remove tag from usertag | text |
GetAllTags | Fetches user's all tags from OneSignal |
EnablePush | Enable Push notifications |
DisablePush | Disable Push notifications |
IsSubscribed | Returns user's subscription status |
LogOut | Logs out current user. It has no effect on Push Notifications. |
RetrieveBackgroundNotifs | Retrieve all cached notifications which were received when app was closed |
ClearBackgroundNotifs | Clears all cached notifications |
SendToAllSubscribers | Send notification to all subscribed usersapiKey | text appId | text title | text body | text largeIcon | text data | dictionary |
SendToSubsIDs | Send notification to all specified Subscriber IdsapiKey | text appId | text ids | list title | text body | text largeIcon | text data | text |
SendCustomNotif | Send custom notificationapiKey | text jsonString | text |
Properties
SdkVersion | Returns OneSignal SDK version Property Type : read-only Accepts : text |
Language | Sets user language Property Type : write-only Accepts : text |
SmallIcon | Sets small icon (from Assets) to be used in notification Property Type : write-only Accepts : text |
UseBigPicture | Uses largeIcon as Big Picture in notification sent using blocks Property Type : write-only Accepts : boolean |
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!