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/