-
Notifications
You must be signed in to change notification settings - Fork 28
Home
Pushover4J aims to be the easiest to use java client for pushover. We will try to fill out the wiki here with everything that you need to know to use all the features that Pushover4J supports. If anything is missing please raise an issue and note that the wiki is missing or jump in and help out.
###Using Pushover4J Pushover4J currently supports the following PushoverAPIs:
-
Message API
- Including the Sounds list
- Group and User Verification
-
Receipt API
- Callbacks are not natively part of the api since they are not part of the call/response model implemented by Pushover4J.
Currently all priority levels (including Emergency are supported. The latest sound list can be also updated from Pushovers sound api.
The main page has a basic example repeated here but sending a message requires 1 initial setup step and 2 instance steps to alert a user via the service.
(only necessary at startup/setup)
To be able to send any messages a Rest API Client must be created
PushoverClient client = new PushoverRestClient();
This client holds an Apache HttpClient object used to reach the Pushover servers and a cache of all known sounds (provided the getSounds call is used, optional).
PushoverMessages are generally created through the PushoverMessage Builder.
PushoverMessage msg = PushoverMessage.builderWithApiToken("MY_APP_API_TOKEN")
.setUserId("USER_ID_TOKEN")
.setMessage("testing!")
.build()
The above message is the bare minimum required by the Pushover API. Other Parameters can be added to augment the message and take advantage of the full abilities of the service.
Once a PushoverMessage has been created a simple call through the client will return the basic Status of the message.
Status result = client.pushMessage(msg);
Status has 2 parameters included that indicate the success or failure of the send.
result.getStatus() - returns 1 if success, 0 if failed
result.getRequestId() - serial of the request
A more detailed response can be requested that includes more details of the servers response.
Any contributions to the project are welcome. See who has helped so far and how you can get involved.