Forum Xamarin.Android

Unable to get real-time values from AWS DynamoDb

ali_jaxxadali_jaxxad Member ✭✭
edited April 2018 in Xamarin.Android

I have single entity in DynamoDB Table and its items are updating with respect to time, i'm trying to get those updated values in my Android app. below is my Xamarin code for what i'm trying to do but after receiving few values from DynamoDb it gets stuck. Also i'm new to Xamarin and AWS,

using Android.App;
using Android.Widget;
using Android.OS;
using Amazon;
using Amazon.DynamoDBv2;
using Amazon.DynamoDBv2.DataModel;
using Amazon.CognitoIdentity;
using System;
using System.Threading.Tasks;

namespace AWS_TESTING

    [Activity(Label = "AWS_TESTING", MainLauncher = true, Icon = "@mipmap/icon")]
    public class MainActivity : Activity
        CognitoAWSCredentials credentials = new CognitoAWSCredentials(

        protected override void OnCreate(Bundle savedInstanceState)

            Button GetDataButton = FindViewById<Button>(Resource.Id.GetData);
            TextView UserRpm = FindViewById<TextView>(Resource.Id.DataRpm);
            TextView UserSerial = FindViewById<TextView>(Resource.Id.DataSerial);
            TextView UserSpeed = FindViewById<TextView>(Resource.Id.DataSpeed);
            TextView UserTimestamp = FindViewById<TextView>(Resource.Id.DataTimestamp);

            var loggingConfig = AWSConfigs.LoggingConfig;
            loggingConfig.LogMetrics = true;
            loggingConfig.LogResponses = ResponseLoggingOption.Always;
            loggingConfig.LogMetricsFormat = LogMetricsFormatOption.JSON;
            loggingConfig.LogTo = LoggingOptions.SystemDiagnostics;

            var client = new AmazonDynamoDBClient(credentials, RegionEndpoint.USEast1);
            DynamoDBContext context = new DynamoDBContext(client);

            async void Getdata()
                OBDdata retrievedBook = await context.LoadAsync<OBDdata>("1");
                UserSpeed.Text = "Speed: " + retrievedBook.Speed.ToString();
                UserRpm.Text = "RPM: " + retrievedBook.RPM.ToString();
                UserSerial.Text = "Serial ID: " +;
                UserTimestamp.Text = "Time: " + retrievedBook.Time.ToString();

            async void StartTimer()
                await Task.Delay(1000);

Sign In or Register to comment.