- Home
- Documentation
- Client Setup
- iOS
- Create App
- Get the SDK
- Enable Capability
- Register Devices
- Handle Notifications
- Subscribe to Topics
- Setup APNs Authentication
- Send Test Notification
- Android
- Create App
- Get the SDK
- Register Devices
- Modify Launcher Activity
- Modify AndroidManifest
- Setup BroadcastReceiver
- Parse Notification Data
- Subscribe to Topics
- Send Test Notification
- Web Push
- Create App
- Get the SDK
- Register Visitors
- Handle Notifications
- Subscribe to Topics
- Send Test Notification
- Additional Platforms
- Ionic
- Flutter
- Python
- macOS
- Angular
- Electron
- Cordova
- Capacitor
- PhoneGap
- React Native
- MAUI (Android)
- Xamarin (Android)
- Migration Guides
- Backend Setup
-
API Reference - SDK Reference
- Additional Resources
Got Feedback?
We'd love to hear what you have to say about our documentation. Let us know how we can improve it.
Store Device Tokens
Every user is assigned a unique device token that you need to keep track of in your backend in order to send it push notifications in the future.
Once a device has been registered for notifications by calling Pushy.register()
, send its device token to your backend. You could execute a web request from your client code to achieve this:
// Register the device for notifications (returns its device token)
String token = Pushy.register();
// Sample code to send "token" to your backend server via an HTTP request:
new URL("https://api.example.com/register/device?token=" + token).openConnection();
Note: This sample code is in Java
, please reimplement accordingly.
Your backend should store the device token in its database for later, when you're ready to send the device a notification. We'll see how to do just that on the next page.