cl jPushbullet2: A Java Pushbullet Client Library


Support This Project

Download now! (v0.3 233 KB)

Follow the file release RSS feed...

This is a Public Domain Java library for interacting with the Pushbullet service. It supports both sending and receiving notifications. Thanks to shakethat at github for the insights from his library, which was made for an earlier set of Pushbullet APIs. Thanks to hakan42 at github for getting this library converted and set up for Maven.

The Pushbullet HTTP API identifies seven capabilities, of which jPushbullet2 supports five:

Pushbullet APISupported in
Future Plans
/v2/contactsNoWill explore this later

View the jPushbullet2 javadoc API online, if you like.

This jPushbullet2 library uses a few other libraries, which you will need to add to your classpath/project:

So for instance my lib folder has the following files:


The quickest way to understand the library is to see some examples. These examples and more are included in the source code.

To send a note:

public class SendNote {
    public static void main(String[] args) throws PushbulletException{
        PushbulletClient client = new PushbulletClient( "" );
        String result = client.sendNote(null, "My First Push", "Great library. All my devices can see this!");
        System.out.println( "Result: " + result );
    }   // end main
}   // end Note

To retrieve, on another thread, all pushes ever sent with this Pushbullet account:

public class GetPushesAsync {
    public static void main(String[] args) throws PushbulletException, InterruptedException{
        PushbulletClient client = new PushbulletClient( "" );
        Future fut = client.getPushesAsync(new Callback<List<Push>>() {
            public void completed(List pushes, PushbulletException ex) {
                System.out.println( "Number of pushes: " + pushes.size() );
                for( Push push : pushes ){
                            push.getTarget_device_iden()+ "\t" + 
                            push.getType() );
        System.out.println("1 sec has passed. Done yet? " + fut.isDone() );
    }   // end main
}   // end GetPushesAsync

To listen for new incoming pushes and other changes to your Pushbullet account:

public class StartStopWebservice {
    public static void main(String[] args) throws PushbulletException, InterruptedException{
        if( args.length < 1 ){
            System.out.println("Arguments: API_KEY ");
        } else {
            PushbulletClient client = new PushbulletClient( args[0] );
            client.addPushbulletListener(new PushbulletListener(){

                public void pushReceived(PushbulletEvent pushEvent) {
                    System.out.println("pushReceived PushEvent received: " + pushEvent);

                public void devicesChanged(PushbulletEvent pushEvent) {
                    System.out.println("devicesChanged PushEvent received: " + pushEvent);
            System.out.println("Getting previous pushes to find most recent...");
            System.out.println("Starting websocket...try sending a push now.");
            // Wait 30 seconds
            for( int i = 30; i >= 0; i-- ){
                System.out.print(" " + i + " ");
            System.out.println("Stopping websocket");
    }   // end main
}   // end StartStopWebservice

A Note About Public Domain

I have released this software into the Public Domain. That means you can do whatever you want with it. Really. You don't have to match it up with any other open source license — just use it. You can rename the files, move the Java packages, whatever you want. If your lawyers say you have to have a license, contact me, and I'll make a special release to you under whatever reasonable license you desire: MIT, BSD, GPL, whatever.


blog comments powered by Disqus