# Push

Canonical page: https://docs.ovok.com/java-sdk/push

`ovok.push()` has two halves. `devices()` registers the devices a signed-in person receives push on, each their own. `provider()` holds the provider the project's push goes through (`fcm`, `apns`, `expo` or `relay`) and is for project admins.

## Register a device [#register-a-device]

```java
JsonNode device = ovok.push().devices().register(
        Map.of("token", token, "platform", "android", "appId", "com.example.care"),
        RequestOptions.defaults());

ovok.push().devices().unregister(device.get("id").asText(), RequestOptions.defaults());
```

- Registering the same token again answers the same device. The token is never returned.
- `list` shows the signed-in person's devices under `devices`.
- `unregister` removes a device, which then gets no more push.

## Set up the provider [#set-up-the-provider]

```java
JsonNode relay = ovok.push().provider().create(
        Map.of("provider", "relay", "url", "https://push.example.com/ovok"),
        RequestOptions.defaults());
String signingSecret = relay.get("secret").asText();
```

- `create` checks the credentials with the provider first. A relay's `whsec_` signing secret is answered this once.
- `retrieve` reads the provider and its settings, never a secret. `update` changes the provider set up, and `remove` removes it.

## See also [#see-also]

- [`PushResource` reference](/java-sdk/reference/push-resource): every method.
- [Omni-channel alerts](/java-sdk/omnichannel-alerts): the rule that decides who hears of each alert.
