0

I am developing an Android application for learning purpose using Kotlin. I am using DynamoDB as backend. I am new to that as well. I know how to query the records from a table in Android Kotlin using AWS Android SDK. I fetch all the records from a table like this.

val dynamoDBClient = AmazonDynamoDBClient(AWSMobileClient.getInstance().credentialsProvider)
            val fetchedItems: ArrayList<Any> = ArrayList();

            val scanRequest = ScanRequest().withTableName(MainApplication.DB_TABLE_ITEMS);
            scanRequest.exclusiveStartKey = lastEvaluatedKey


            val scanResult = dynamoDBClient.scan(scanRequest)
            scanResult.items.forEach { item ->
                val viewItem = ItemDO()
                viewItem.id = item.get("Id")?.s
    item.get("Images")?.ns?.size.toString())
            }

But what I am trying to do now is I want to add two new fields into the table called latitude and longitude. Then query to get the records of the nearest location based of a parameter location passed in the query. For that I have to use math functions in the query like sin() and cos() and stuff. How can I use those math functions? Then I found another AWS service called CloudSearch to search geolocation. In the docs, it says it can be used to index and search records in the DynamoDB. But there is no tutorial or docs for Android to use that CloudSearch service to query the Geolocation data in the DynamoDB. There is not Android SDK for that as well. Where can I find a decent tutorial or docs for my scenario?

I looked at the following article, but where is the SDK for Android? Is there an Android SDK for the following article?

https://aws.amazon.com/blogs/mobile/geo-library-for-amazon-dynamodb-part-1-table-structure/

1 Answer 1

0

I have not found the solution. But this is what I am trying to do. I will hook the AWS lambda to my DynamoDB. When an item is added, I will send that item to ElasticSearch or Algolia. The logic of synchronizinfg the data with Elasticsearch or Algolia will be in the Lambda function. Then I will search/query the Geo location data using Algolia or Elastic Search.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.