Android Open Source - habhub-chase-car-tracker Habitat Interface






From Project

Back to project page habhub-chase-car-tracker.

License

The source code is released under:

Copyright (c) 2012, Priyesh Patel All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1...

If you think the Android project habhub-chase-car-tracker listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.pexat.habhub.chasecartracker;
//from   w w  w . j  ava  2 s. c  o m
import java.io.UnsupportedEncodingException;

import org.apache.http.HttpEntity;
import org.apache.http.entity.StringEntity;
import org.json.JSONException;
import org.json.JSONObject;

import com.pexat.net.SimpleHttp;

public class HabitatInterface {
  private static String _habitat_url = "http://habitat.habhub.org/";
  private static String _habitat_db = "habitat";

  protected static String getUUID() {
    String page = SimpleHttp.get(_habitat_url + "_uuids");

    try {
      JSONObject j = new JSONObject(page);
      page = j.getJSONArray("uuids").getString(0);
    } catch (JSONException e) {
      e.printStackTrace();
      return "";
    }

    return page;
  }

  protected static void sendListenerTelemetry(ListenerTelemetry l) {
    String putURL = _habitat_url + _habitat_db + "/" + HabitatInterface.getUUID();
    StringEntity stringdata = null;
    try {
      stringdata = new StringEntity(l.getJSON());
    } catch (UnsupportedEncodingException e) {
      e.printStackTrace();
    }
    HttpEntity data = (HttpEntity) stringdata;

    SimpleHttp.put(putURL, data);
  }
}




Java Source Code List

com.pexat.habhub.chasecartracker.About.java
com.pexat.habhub.chasecartracker.AppInfo.java
com.pexat.habhub.chasecartracker.HabitatInterface.java
com.pexat.habhub.chasecartracker.ListenerTelemetry.java
com.pexat.habhub.chasecartracker.Main.java
com.pexat.habhub.chasecartracker.TrackerService.java
com.pexat.net.SimpleHttp.java