noahjillson
noahjillson

Reputation: 122

How to find the time it will take to travel between two places in an android app

I am working on a school project and need to calculate the time it will take to travel between two locations preferably with the option to specify the mode of transportation inside of an android app.

I have come across the Google Distance Matrix API (documentation here) which seems to have the features that I am looking for, but it warns...

"If you are building a mobile application, you will need to introduce a proxy server to act as intermediary between your mobile application and the Google Maps API Web Services."

I know that this is for the protection of the API key and want to follow this pretty diligently. I'm wonder, is there another way to get the data I need for the app without setting up a proxy server?

I know I could use a service like Heroku to run the code that accesses the API, but this seems like a difficult option given that this is just a school project. Any other ideas on how to get the travel time for my app?

Upvotes: 1

Views: 175

Answers (1)

evan
evan

Reputation: 5691

Setting up a proxy server is the best way to secure your API key, but Google also suggests other security techniques such as obfuscation and pinning.

Having said that, if this is a school project and you won't make your API key public in a production environment, then you can just leave your API key unrestricted (and without a proxy server).

But do make sure that you monitor your API usage on a regular basis and that you regenerate your API key periodically and/or as needed. It's also strongly recommended that you set daily quota limits and budget alerts as per this FAQ so that you don't go over budget regardless.

Hope this helps!

Upvotes: 1

Related Questions