Android API

From SubPos
Jump to: navigation, search

The open source API uses the trilateration library from here. This relies on the org.apache.commons.math3 library to work, so you need to include this library in your project.

This initial release has been adapted from the prototype code that has been worked on so far, so bear with me if there are some errors or omissions, but I have tried to make it simple to use (also removing some of the experimental code until it's tested completely).

To integrate this API into an existing positioning application, all you need to do is create a SubPos object like so:

public class yourClass extends Activity {
   SubPos subpos;
   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.main);
       //Create new SubPos service
       subpos = new SubPos(this); //"this" passes the activity's context
   }

Then to get your position call:

SubPosPosition position = subpos.getPosition(); //returns null if position is not calculated

If you have any thoughts, ideas or fixes, by all means let me know if I have missed something, or if you would like to contribute to the API.

Unfortunately, in terms of releasing this on iOS, SubPos will currently not work on a non jailbroken iPhone as they restrict access to the Wi-Fi API. Apple don't even allow Wi-Fi scanning applications (they removed existing ones from the App store too). This is quite a disappointment, considering it is very basic functionality that the hardware is fully capable of supporting. It has also been speculated that this has been done to provide vendor lockin with their iBeacon platform. So while it would be great to get this working on all smartphone platforms, for the moment, unless someone has contacts within Apple to make this happen, it looks like we are stuck with every other device in the world with a Wi-Fi receiver for the time being.