Coder Social home page Coder Social logo

sprockets's Introduction

Sprockets for Java Javadoc Maven Central

Google web service APIs in Java and other utilities

Install

<dependency>
    <groupId>net.sf.sprockets</groupId>
    <artifactId>sprockets</artifactId>
    <version>4.0.0</version>
</dependency>

sprockets's People

Contributors

pushbit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sprockets's Issues

Places.nearbySearch returns maximum 20 results

Hello!

I am trying to get a list of restaurants in a area but the Places.nearbySearch method returns only 20 results, eventhough there is more available. Is it supposed to be like that? Ayn workarounds?

Extend support for the HTTP client to something else than OkHttp

I'm trying to use this awesome library in a Google AppEngine project. And OkHttp is not supported on it.

I'm currently getting the following error:
WARNING: Nested in javax.servlet.ServletException: java.lang.NoClassDefFoundError: java.net.ProxySelector is a restricted class. Please see the Google App Engine developer's guide for more details.:
[INFO] java.lang.NoClassDefFoundError: java.net.ProxySelector is a restricted class. Please see the Google App Engine developer's guide for more details.
[INFO] at com.google.appengine.tools.development.agent.runtime.Runtime.reject(Runtime.java:51)
[INFO] at com.squareup.okhttp.OkHttpClient.copyWithDefaults(OkHttpClient.java:359)
[INFO] at com.squareup.okhttp.OkHttpClient.open(OkHttpClient.java:344)
[INFO] at com.squareup.okhttp.OkHttpClient.open(OkHttpClient.java:339)
[INFO] at net.sf.sprockets.google.Places.reader(Places.java:472)
...

A solution would be to either use native java.net clients (is there any actual reason for using okhttp anyway?) such as new URL(XX).getUrlConnection() or allow users to specify their own implementation (as a parameter for example).

Thanks a lot,
Cosmin

Missing Class Error

Called this API:
Params params = Params.create().latitude(latitude).longitude(longitude).keyword(name);
Response<List> resp = Places.nearbySearch(params);

When executing search, it throws class not found exception with following stack trace:
Exception in thread "main" java.lang.NoClassDefFoundError: com/squareup/okhttp/internal/http/RequestException
at com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl.(HttpsURLConnectionImpl.java:29)
at com.squareup.okhttp.OkUrlFactory.open(OkUrlFactory.java:57)
at com.squareup.okhttp.OkUrlFactory.open(OkUrlFactory.java:48)
at net.sf.sprockets.net.HttpClient.openConnection(HttpClient.java:72)
at net.sf.sprockets.net.HttpClient.openConnection(HttpClient.java:65)
at net.sf.sprockets.google.Places.reader(Places.java:833)
at net.sf.sprockets.google.Places.places(Places.java:799)
at net.sf.sprockets.google.Places.nearbySearch(Places.java:262)
at net.sf.sprockets.google.Places.nearbySearch(Places.java:215)

Some alternative to Maven

Ok, I'm trying to use what seems like a really nice library, but can't get it going because this Rube Goldberg build system is getting in the way. I tried just using the precompiled jar from maven central, but it doesn't include any of the dependencies that were nowhere in the readme file. Is there some way I can do this without having to spend 3 hours with maven?

Doesn't see my API key?

Hi,

First, thanks for making this API available--very cool. I am sure I'm doing something wrong, because I keep getting error below. I would really appreciate some help--stuck.. thank you!

Aug 25, 2013 6:28:22 AM net.sf.sprockets.google.Places$Response$Key get INFO: Unknown response key: debug_info. If this hasnt already been reported, please create a new issue at https://github.com/pushbit/sprockets/issues"

I am using Spring 3 and first I tried to set sprockets in a config bean:

@Autowired private Environment environment;

//doesn't work...
@Bean
public org.apache.commons.configuration.Configuration sprockets() {
Sprockets.getConfig().setProperty("google.api-key", this.environment.getProperty("google_places_api_key"));
return Sprockets.getConfig();
}

Then I tried to set it directly in my test case:

/no dice... @Autowired private Environment environment; ... try { Sprockets.getConfig().setProperty("google.api-key", this.environment.getProperty("google_places_api_key")); List places = Places.nearbySearch(new Params().location(result0.getGeometry().getLocation().getLat().doubleValue(), result0.getGeometry().getLocation().getLng().doubleValue()).radius(15000) .types("post_office") .maxResults(5)).getResult(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }

Lastly, I created a sprockets.xml and wired it up as an import in my applicationcontext.xml

// and unfortunately nothing..

<!--applicationcontext.xml-->
<import resource="classpath:sprockets.xml"/>

--sprockets.xml

<sprockets>
<google>
<!-- available from the Google APIs Console https://code.google.com/apis/console/ -->
<api-key>ABC123</api-key>
</google>
<hardware>
<!-- does the device this will run on have a location sensor? -->
<location>false</location>
</hardware>
</sprockets>

Getting extended description data

Hi there, i'm trying to use your library and it seems i don't get the extended information for a Google Place. i'm trying to get the phone number and that doesn't come back from the main Places query. I know from looking at the Google Places docs you have to do the extended query on the reference that comes back from the basic listing. Does your library do that or do you have a way to get that data?

Thanks,
John

Examples dont compile

StreetView.image(new Params().location(40.748769, -73.985332).heading(210).pitch(33).fov(110)).getResult();

"heading" is not recognised.

Also:

StreetView.image(new Params().location("18 Rue Cujas, Paris, France")).getResult();

method location in class Params cannot be applied to given types;
required: double,double
found: String
reason: actual and formal argument lists differ in length

Any ideas? Im really interested in using this :)

bad query param value encoding

On Places.java at 1131 line, the "query" param encoding is wrong. When there is space symbols in the query param value, they get replaced by "+" when they should be replaced with %20. Otherwise google api won't return proper results.

Wrong status output?

Hi, I am getting the wrong status for this query:

CODE

Response<List> resp = Places.nearbySearch(Params.create().longitude(-10.460491).latitude(137.895137).radius(50000).keyword("shop"));
String status = resp.getStatus();
System.out.println(status);


OUTPUT: INVALID_REQUEST

BUT

Response<List> resp = Places.nearbySearch(Params.create().longitude(-10.460491).latitude(13.895137).radius(50000).keyword("shop"));

WORKS - "ZERO_RESULTS"?

Please help - google.api-key not set

I have created the following sprockets.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<!-- Configure library settings. -->
<sprockets>
<google>
     <api-key value="#{systemEnvironment['GoogleApiKey']}"/>
    <street-view>
        <use-api-key>false</use-api-key>
    </street-view>
</google>
<hardware> 
    <!-- Does the device this will run on have a location sensor? -->
    <location>false</location>
</hardware>
</sprockets>

I have also tried loading the key plaintext with no luck:
< api-key > My-Key-Here-Plaintext </ api-key >

I think it has something to do with where I am putting the XML file...I have tried putting it at the classpath root but am having no luck...can someone give me more specific instructions as to how to get this xml loaded?

Thanks!

Place ID - unknown response

hi pushbit,

I've been using your lib for quite a while now for my app dev. Took a break of about one month and now that I'm back I see google introduced a new field called 'place_id' ? Not sure if I'm right tho.

This is the exception I get:

Jul 05, 2014 6:55:07 PM net.sf.sprockets.google.Places$Response$Key get
INFO: Unknown response key: place_id. If this hasn't already been reported, please create a new issue at https://github.com/pushbit/sprockets/issues

Good-day!

googleplace search

googleplace search doesn't show dropdown. how can i show it? also example doesn't work

Null from details search

Hello pushbit,

I see you've updated the details search parameters and now we need to pass the Place ID parameter.

However, I've been trying to make it work for the past hour and I keep getting the NullPointerException whener I try to acces the detailed place.

Here is a chunk of my code:

    if (status == Places.Response.Status.OK && places != null) {
        for (Place place : places) {
            try {
                mPlaceDetails = Places.details(new Places.Params()
                        .placeId(place.getId()),
                        Places.Field.FORMATTED_PHONE_NUMBER,
                        Places.Field.OPEN_NOW,
                        Places.Field.OPENING_HOURS,
                        Places.Field.URL
                        );


            } catch (IOException e) {
                e.printStackTrace();
            }

            Place detailPlace = mPlaceDetails.getResult();
  • the detailPlace is always null

getLatitude() and getLongitude() return -Infinity

getLatitude() and getLongitude() return -Infinity

Intent intent = new Intent("ADDRESS_CHANGED");
            intent.putExtra("address", prediction.getName());
            intent.putExtra("latitude", prediction.getLatitude());
            intent.putExtra("longitude", prediction.getLongitude());
            LocalBroadcastManager.getInstance(getActivity()).sendBroadcast(intent);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.