-
Notifications
You must be signed in to change notification settings - Fork 947
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding support for the Geolocation API call. #164
Conversation
@@ -15,13 +15,17 @@ | |||
|
|||
package com.google.maps; | |||
|
|||
import static com.google.appengine.repackaged.com.google.common.base.StringUtil.JsEscapingMode.JSON; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to be an issue, we don't want to require appengine code for users who aren't on GAE
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is just a bad import from an IDE. You can drop the com.google.appengine.repackaged.
prefix and you should be fine.
Hey @markmcd can you please check this PR for sanity? Thanks! |
/** | ||
* {@code signalStrength}: The current signal strength measured in dBm. | ||
*/ | ||
public int signalStrength; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the int fields optional? If so, is it OK that the API will still be sent the default value for int even if the user doesn't provide it?
Hello @markmcd, @domesticmouse , The specific line is PendingResultBase.java:78 in the method makeRequest(). I'd like to override makeRequest but it, and the variables it uses are private. Do you have any objections to me making them protected so that I can override makeRequest in my GeolocationApiRequest class? |
Can you use ApiConfig to define which verb(s) the API uses? |
} | ||
ApiException e; | ||
// try and fit the older error codes into the new style geo api error formats | ||
if(reason.equals("keyInvalid")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move these into the ApiException.from method, where the rest of the string-to-exception mapping occurs?
@@ -57,32 +60,36 @@ public OkHttpRequestHandler() { | |||
|
|||
return new OkHttpPendingResult<T, R>(req, client, clazz, fieldNamingPolicy, errorTimeout); | |||
} | |||
@Override |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems that you have dropped a bunch of blank lines here. Can you put them back please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
added by auto indent, but now removed
@@ -0,0 +1,122 @@ | |||
package com.google.maps.internal; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file appears to be missing it's copyright header. Plz add
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
@@ -0,0 +1,140 @@ | |||
/* | |||
* Copyright 2014 Google Inc. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm guessing this is a new file, so it should have a Copyright year of 2016.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -0,0 +1,165 @@ | |||
/* | |||
* Copyright 2014 Google Inc. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect copyright year?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -0,0 +1,37 @@ | |||
/* | |||
* Copyright 2014 Google Inc. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -0,0 +1,89 @@ | |||
/* | |||
* Copyright 2014 Google Inc. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, missed this date.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -0,0 +1,111 @@ | |||
/* | |||
* Copyright 2014 Google Inc. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Thanks for working through all the issues in this PR Kenneth! |
This pull request is to initiate a discussion on the proposed changes to support the Geolocation API. Geolocation uses POST calls so support for POST was implemented in both the OkHttp and GAE handlers.
A simple test case was created, it fails, but I believe that's because I am using assert wrong or creating the result object incorrectly. The call to the server is working and that can be seen by running the tests with the --info flag.
The new code can be exercised with:
$ API_KEY=AIza... ./gradlew test --info --tests com.google.maps.GeolocationApiTest
Output: