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.