Skip to content
Hal Hockersmith edited this page Jul 10, 2016 · 5 revisions

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:

Currently all priority levels (including Emergency) are supported. The latest sound list can be also updated from Pushovers sound api.

Sending a message

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.

Setup the client

(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).

Creating a message

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.

Sending the message

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.

Help Wanted

Any contributions to the project are welcome. See who has helped so far and how you can get involved.