Thursday, February 27, 2014

Easiest way to get current location on an android

The newest update of the NY Coffee Map app has a feature to launch navigation to the nearest coffee shop on the map. Android makes location-finding easy. Every device can find its coordinates through GPS  and NETWORK (includes cell tower triangulation and WiFi) It has it's own class "Criteria" to determine which of these is best, taking into account battery, accuracy, whats on, etc.
Here's code (nestled in onCreate) to find the Location we've cleverly named 'devicelocation'

Criteria criteria = new Criteria(); provider = locationManager.getBestProvider(criteria, true); 
Location devicelocation = locationManager.getLastKnownLocation(provider);

n.b. The true in the .getBestProvider tells the method to only select a provider that is currrently enabled.
Once you have that location, getting the latitude an longitude is as easy as requesting it! We save them as doubles called 'currentlat' and 'currentlong'


currentlat = location.getLatitude();
currentlong = location.getLongitude();

And, bingo, you have your latitude and longitude coordinates saved. Note that since we put the Location code in onCreate, we only get a new set of coordinates when the Activity is launched. Adding this method to your code, outside of onCreate obviously, will give you more updates:

@Overrideprotected void onResume() {
  super.onResume();

  if (provider != null){    
    locationManager.requestLocationUpdates(provider, 400, 1, this);
  }

}

@Override 
public void onLocationChanged(Location location) { 
  currentlat = location.getLatitude(); 
  currentlong = location.getLongitude(); 
}

In the next post, I will show how to launch navigation to get to these coordinates!

Thursday, February 13, 2014

The best coffee in Brooklyn and Queens!

In response to the popularity of the original map/app, the entire team at Butterfruit Labs has been investigating the coffee in Brooklyn and Queens (the birthplace of NY's coffee scene may it be argued). There has never been such a rampant, highly-caffeinated, group of geeks. Dozens of shops encountered mysterious interviewers demanding specifics about their coffee. 

Ok, so it's not all of Brooklyn and Queens, but it has the areas with good coffee. A few lines, such as the L and the G, had fierce competition. Other stops (ahem, Woodside and Corona - and come on Barclays Center) had our researchers struggling to find one good cup. Overall, this map should not disappoint, and hopefully, will incite some passionate (yet hiply nonchalant) rage! Without further ado, the map:


Wednesday, February 12, 2014

release date!

Tomorrow morning, Butterfruit Labs will be releasing the newest coffee map: a revision of Manhattan, addition of WiFi symbols, and the much-requested, Brooklyn + Queens. Follow @butterfruitlabs on twitter, check this blog, or watch the nyc subreddit! The app will be updated overnight!

Sunday, February 9, 2014

Lucky Nirms

Nirmal had the very fortunate opportunity of having his dinner last night cooked by done other than Steph, head chef of Steph's Apartment Kitchen. Kofta, baba ganoush, shepherd's salad... oh my Ghandi!

Saturday, February 8, 2014

Map updates

Our coffee map has become very popular, and we've received a ton of suggestions and feedback! And, it's official, the map will be expanding to other boroughs. I also think that WiFi icons will be added. WiFi is a little bit of a paradox for 2014 - there shouldn't be any coffeeshops that can't provide WiFi, but then again, there shouldn't be anyone who needs to rely on a coffee shop to provide it. There are some (looking at you, Juliano) that don't allow laptops at all, but that's a different story. Anyway, stay tuned, I'll post the new stuff right here. You can also follow @rickymikeabono or @butterfruitlabs on twitter, and the NYC subreddit is highly recommended. If you have a favorite spot of your own, please tweeit it, share it below, or email butterfruitlabs@gmail.com

Tuesday, February 4, 2014

NYC Best Coffee

Nirmal and Ricky have been spending a lot of time together in NYC lately, and, cappuccino fuels Nirmal's programming. This weekend Butterfruit Labs put together a list of the best coffeehouses in Manhattan, by subway stop.

The coffeehouses which made the cut were selected based on their equipment, the type/source of beans used, stop proximity, and reviews from both customers and professionals. Unique spots also got priority. In cases of multiple stores, the original or most popular location of that chain was weighted more heavily. Shops which embraced their neighborhoods feel were also favored. Some locations didn't have great options, and Dunkin Donuts or Starbucks had be chosen.