N76/issue4/refactor : Choose API server#14
Conversation
MapQuest now requires a developer API key to be used when querying their Nominatim server. This change allows the end user to enter a key that they can get without charge from the MapQuest developer site at https://developer.mapquest.com Signed-off-by: Tod Fitch <Tod@FitchDesign.com>
Android Studio was too helpful in suggesting changes and automatically editing the manifest. Signed-off-by: Tod Fitch <Tod@FitchDesign.com>
* MapQuest server needs a developper API key. See : https://developer.mapquest.com/
7edc021 to
f6ca893
Compare
|
Issues reference:
|
|
@be-neth: Can you please leave minSdkVersion to 9? |
|
@ale5000-git No, sorry. I answered you on the other pull request comment:
|
|
You can use the v4 support library to still keep minSdkVersion at 9. |
| try { | ||
| Log.d(TAG, "Requesting " + url); | ||
| HttpURLConnection connection = (HttpURLConnection) new URL(url) | ||
| HttpsURLConnection connection = (HttpsURLConnection) new URL(url) |
There was a problem hiding this comment.
You can keep this at HttpURLConnection as you don't use any feature of HttpsURLConnection. Casting this to a HttpsURLConnection instance does not improve security ;)
There was a problem hiding this comment.
Casting this to a HttpsURLConnection instance does not improve security ;)
Yes obviously :)
But maybe it can be a good practice to use HttpsURLConnection object in case we need in the futur to play with the HTTPS connection parameters.
There was a problem hiding this comment.
I tend to use the least specific class that still suites my needs, in this case that would be HttpURLConnection. Just consider that a future Java version might decide that http 2.0 is not done using HttpsURLConnection, although it es encrypted. It's also very unlikely that we ever want to fiddle with tls parameters and finally using classes from the javax package should generally be done only if really needed.
In the end I use PreferenceFragmentCompat from android v7 support library. The only difference is I cannot subclass PreferenceActivity anymore but I need to use AppCompatActivity to have : getSupportFragmentManager(). Thanks @mar-v-in for the reference. |
This reverts commit a156299.
|
Great work! Includes @n76 of course ;) |
Refactor of pull request #7 .
User can choose between OSM or MapQuest API server.
Use HTTPS.
OSM API server
Free, without API key.
For usage policy see : http://wiki.openstreetmap.org/wiki/Nominatim_usage_policy
MapQuest API server
Needs to have an API key.
Limited to : 15,000 transactions/month
See : https://developer.mapquest.com/