Widespread Augmented Reality

Widespread Augmented Reality
Click on the image to get the Android Augmented Reality Heads up Display

Saturday, July 11, 2015

Update to Google Maps API Suddenly Exceeding Quota

Follow these links:
  • The Google Geocoding API
  • Geocoding Strategies
  • The key (no pun intended) here is whether you will use a browser key or a server key. Since my PHP script is using file-get-contents($requestURL), where $requestURL might look like this

    https://maps.googleapis.com/maps/api/geocode/json?latlng=

    I will create and copy the server key from the
    https://console.developers.google.com/project

    Now I am still trying to figure out where to place this code in the PHP/HTML/Javasript page. You'd think that

          src="https://maps.googleapis.com/maps/api/js?key=API_KEY">
        
    would work. But not necessarily so. Stay tuned.

    Thursday, July 9, 2015

    Google Maps API

    Last night while testing the features of SpiderOnFire, I found that step 2 Mark stopped working. After adding an echo,I realized that my call to the maps API using the clever key "abcdefg" stopped working after years of service.

    A quick visit to google developers console allowed me to properly define a key associated with this project: Widespread Augmented Reality

    Get one for yourself be following these steps:

  • Find APIs&Auth in left pane
  • Select APIs
  • Create key for browser
  • Select credentials in left pane to verify
  • Copy key into your web page code
  • Example:
    
    
    define("MAPS_HOST", "maps.google.com");
    define("KEY", "AIzaSyC6Fhp2Q78tcAf3FVmkY--xxxxxxxxx");
    .....
    $base_url = "http://maps.googleapis.com/maps/api/geocode/json?latlng=" ;
       $location = $_POST['latlng'];
       $location = substr($location,1,-1);
       $location = str_replace(" ","",$location); 
       
       $emd_url =  "&sensor=false" ;
       $request_url = $base_url . $location . $emd_url;
       $jsoncontents = file_get_contents($request_url) ;
       $decodedjson = json_decode($jsoncontents);
       $formattedaddy= $decodedjson->results[0] -> formatted_address;
    
    
     
    
    
    

    Wednesday, June 3, 2015

    Google's Mobile Friendly Test

    If you are hoping to rise up the ranks of Google's new mobile search algorithm, the mobile friendly test is a good place to start.

    Tuesday, April 28, 2015

    Android Shapes and Animation with XML

    Here is the Java code in the main activity that animates using the XML below.

    //main_activity.java
    
    ... Animation rising =AnimationUtils.loadAnimation(this,R.anim.rising);
    ImageView bubble = (ImageView)findViewById(R.id.animatedFrame2);
    bubble.startAnimation(rising); ...
    //end of main_activity.java
    

    anim/rising.xml

    drawable-hdpi/bubble.xml

    layout/main_activity.xml

    Wednesday, April 22, 2015

    Companies with Android Job Opportunities

    The following Los Angeles companies sought Android development during 2014.
    • GumGum Inc
    • ACTV8
    • Applico Inc.
    • Age of Learning
    • EHarmony
    • OurStay
    • Westside Rentals
    • NClusive
    • Unified Dispatch
    • WeMo
    • Sparks Networks
    • Jogg
    • J2 Global
    • LoopNet

    Thursday, April 9, 2015

    Android Async Task and Multiple Parms

    I am building a pop up window to display text that is available on the main UI, but the pop up also needs to display an image that is downloaded from the server. Therefore the entire method that builds the pop up window needs to be on a background thread, for building the window text on the main UI and then making a network image call results in the image not being in sync with the text description.

    In order to build the pop up window in the background, I need to pass parms and a URL into the Async Task.
    To do this I essentially created a Popup variable like so:
     
    public static class PopupParms {
    
                 private String burl; 
    
                 private int type;  
    
                 private int position; 
    
                 private Bitmap bm; 
     
    }
    
    

    This class is inside the larger class that contains the async task.


    Then I instantiate on the main UI with:
    PopupParms pp = new PopupParms() and assign values like:
    pp.burl = a_url;
    pp.position = row_number;
    pp.type = row_type;
    etc...
    Now I call the AsyncTask with:
    new buildPopUpWithURL().execute(pp);
    The AsyncTask class will look like this:
    public class buildPopupWithURL extends AsyncTask 
    
         '<'PopupParms, Integer, PopupParms'>' { 
    
    
      @Override
      protected void onPreExecute() { 
    
        }
    
      @Override
    
      protected PopupParms doInBackground(PopupParms... parms) { 
    
        
        HttpGet reuest = new HttpGet(parms[0].burl); 
    
        . 
    
        . 
    
        . 
    
        Bitmap bm = BitmapFactory.decodeStream(inputstream, null, null); 
    
        PopupParms pp = new PopupParms(); 
    
        pp.bm = bm; // broken out for illustration 
    
        pp.position = parms[0].position; // broken out for illustration 
    
        pp.type = parms[0].type; // broken out for illustration  
    
        return pp; 
    
      } 
    
      @Override 
    
      protected void onPostExecute(PopupParms p) { 
    
        // broken out for illustration 
    
        PopupParms pms = new PopupParms();  
    
        pms.type = p.type; 
    
        pms.position = p.position; 
    
        pms.bm = p.bm; 
    
        // A build method on the main UI
        buildPopup( pms.position, pms.type, pms.bm); 
    
    
    
      }
    
     

    In conclusion, I created a custom class variable that contains the multiple fields that need to be passed into an AsyncTask. After I pass that class variable into the AsyncTask, I parse out and read the member fields of that class variable.
    High level representation of passing multiple parameters into an AsyncTask:

    You can see this live with SpiderOnFire's Widespread Augmented Reality app.