Skip to content

Instantly share code, notes, and snippets.

@sebastienblanc
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sebastienblanc/d89e41b72c9de537dbde to your computer and use it in GitHub Desktop.
Save sebastienblanc/d89e41b72c9de537dbde to your computer and use it in GitHub Desktop.

Hi Folks !

During our last f2f we agreed on adding some geolocation support for the next UnifiedPush Release (1.1). I would like to start here a thread to discuss this topic.

Let's keep in mind : Crawl, Walk, Run

I would like to start with a concrete proposition and initiate the discussions from there :

Installations

Model Change

The idea is to add 2 new fields to the Installation Object :

double longitude;
double latitude;

These field should be optional !

Registration

When the device registers, along with alias, categories etc ... it will also be possible to pass a latitude and longitude.

Later, we will probably offer a endpoint to update these properties. PUT /registry/device/{token}

Sender

Server Side

We need to extend the current sender API to be able to add geolocation as a criteria. I see that as something like :

{
  "message":{
    "alert":"HELLO!
  },
  "criteria":{
   "geolocation":
       {
      "latitude" : 40.2566
      "longitude": 2.36556
      "within" : 5 
      "unit" : "Km" // optional, default is Km  
       }
  }
}

In this example, the Push Notification will be sent only to devices within a radius of 5 km of the supplied location.

On the implementation side, I think it make sense to use Hibernate Search since it has nice support for Spatial queries.

Sender Client

The different Sender Clients (Java, Node.js, .net) should be updated accordingly.

Client SDKs

In this fisrt iteration, the registration code would to be updated to include latitude and longitude for :

  • iOS (Including Safari ? )
  • Android ( Including Chrome Apps ?)
  • JS UPS-SPS Lib
  • Cordova Plugin
  • Amazon
  • Windows

Retrieving the current position of the device is not in scope of this first version, later we could offer some features around that.

There are some jiras to track these tasks : https://issues.jboss.org/browse/AGPUSH-828

Comments and questions welcome !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment