How to use endpoints for Android with App Engine S

2019-09-07 17:48发布

I will need to store a lot (anywhere from 100k to 10 million) longitude/latitude (geo)points with some extra variables attached. When the user logs in to my Android application it will request all geopoints within a kilometer radius.

I've read blogs, documentation and questions on stackoverflow and came to the conclusion that the best match would be using Google App Engine in combination with the App Engine Search API and make endpoints connected to my Android Application.

I recently followed this tutorial and succesfully had my Android Application get data from App Engine Datastore, so the endpoint side I got (more or less) covered.

I have the following questions:

  1. Does the combination of App Engine, Search API and endpoints make sense?
  2. With the tutorial above, my app retrieved data from Datastore. It should actually retrieve from Search API. Is this possible with my current setup of endpoints? This tutorial shows how to create, add and retrieve(search) documents inside an index. Can the code of that tutorial be inserted into Appengine side of my endpoints?
  3. Is there any good tutorial that I've missed concerning this (besides the two linked above) for my goal or possibly even better, any opensource example of the above described setup?

Important edit: I am writing the App Engine in Java.

Thanks in advance,

(I am new to App Engine, Endpoints and Search API, trying to find my way and learning fast).

1条回答
小情绪 Triste *
2楼-- · 2019-09-07 18:31
  1. The combination does make sense. App Engine as a platform is so powerful exactly because you have access to so many APIs and services like search API and enhancements to your workflow like the Endpoints system, instead of simply defining an API servlet and your own protocol (or implementing jsonrpc2.0, for example)
  2. Yes, you can use an endpoint API function to run any kind of code you could run anywhere else in your app. You could have your endpoint getNearbyPoints (GeoPoint p) function run a search API query and return the results. In order to link this all together, I'd recommend storing the full data (you mentioned there is lots of metadata) for a point in Datastore as an entity, but in the corresponding "document" in the search API, storing only the Datastore ID of this entity, so that your endpoints API function code can use the search API to query by distance from point p, then convert the results into full objects to send back.
  3. You could take a look at these additional resources. Not sure if you've read any or all of them, but they contain valuable info anyways.
查看更多
登录 后发表回答