OneSignal makes engaging customers simple and is the fastest, most reliable service to send push notifications, in-app messages, SMS, and emails.
This project demonstrates integrating the OneSignal SDK into an Android project built with Kotlin. You can use this project as a boilerplate or reference to start your project.
This project assumes that you already have a OneSignal app created with push notifications setup. If you don't yet have a OneSignal app, create one first, then follow the steps below to integrate the OneSignal SDK into your Android or iOS app.
- Android Studio Chipmunk.
- OneSignal account and project.
- Firebase Server Key.
- Physical or virtual device.
To test this example, clone this repository as follows:
git clone https://github.com/OneSignalDevelopers/OneSignal-Android-Push-Sample
In Android Studio:
- Open the project.
- Click the green play icon to run the app.
## Send notification
# https://documentation.onesignal.com/reference/create-notification
curl -X "POST" "http://notifications" \
-H 'Content-Type: application/json' \
-u '<Your REST API Key>:' \
-d $'{
"headings": {
"en": "🥳🍾🎊"
},
"included_segments": [
"Subscribed Users"
],
"app_id": "<Your APP ID>",
"contents": {
"en": "You recieved your first push!"
},
"url": "https://onesignal.com"
}'
Navigate to Messages and select In-App from the submenu...
Choose New Message button...
Choose New In-App from the dropdown.
Name the In-App Message "Sample IAM"...
Configure the In-App Message to be presented to All Users...
Use the block editor to create the content of your In-App Message...
Configure the In-App Message to trigger when a certain condition is met i.e., show_sample_iam is 1
...
Schedule the In-App Message to be presented immediately, to show until dismissed by the user, and to present itself everytime the trigger contions is met. Then choose Make Message Live...
Review configuration and confirm when correct.
Tap the Present In-App Message button in the sample app to present In-App Message.
You can ask questions about the OneSignal xxx SDK and related topics in the onesignal-xxx-sdk repository.
🙋♂️ Ask a question
If you receive an error message or get blocked by an issue, please create a bug report!
For additional resources, please join the OneSignal Developer Community.
Get in touch with us or learn more about OneSignal through the channels below.
- Follow us on Twitter to never miss any updates from the OneSignal team, ecosystem & community
- Join us on Discord to be a part of the OneSignal Developers community, showcase your work and connect with other OneSignal developers
- Read the OneSignal Blog for the latest announcements, tutorials, in-depth articles & more.
- Subscribe to us on YouTube for walkthroughs, courses, talks, workshops & more.
- Follow us on Twitch for live streams, office hours, support & more.
Give a ⭐️ if this project helped you, and watch this repo to stay up to date.