Can I create standalone mobile apps using AWS AppSync?

I would like to use AWS AppSync for mobile development (Android / iOS), but I'm not sure about its autonomous capabilities.

According to the documentation, the data will be available during battery life and automatically synchronized if the client reconnects to the network. But I can’t find any information about whether to connect to the AWS client first before using AppSync to create and modify offline data.

I am not familiar with the underlying AppSync technologies (e.g. GraphQL), and I do not have access to the public preview version to test it myself.

I would like to enable privacy sensitive users to use the application without connecting to AWS, although it can still use AppSync as a standalone database. Only if the user later decides to use backup / synchronization data on devices that he or she can choose to connect to AWS.

Can I use this use case with AWS AppSync?

Without using any other local storage (e.g. SharedPreferences, SQLite, Realm, etc.)

+4
source share
4 answers

Firestore, AWS AppSync Backend. , , , / .

.

ToDo

  • Todos

  • ( SQLLITE, Preferences File ..)

  • ,
  • , Backend ( )

Android Shared

public void saveLocalTodo(String title, String details) {
    ArrayList<Todo> todos;
    Todo todo = new Todo(title, details);
    String listOfTodo = sharedPreference.getString(TODOS_LIST, null);
    if (listOfTodo == null)
        todos = new ArrayList<Todo>();
    else
        todos = gson.fromJson(listOfTodo, new TypeToken<ArrayList<Todo>>() {
        }.getType());

    //save at 0th position, recent should always come first
    todos.add(0, todo);
    sharedPreference.edit().putString(TODOS_LIST, gson.toJson(todos)).apply();
}

public ArrayList<Todo> getLocalTodos() {
    ArrayList<Todo> todos;
    String listOfTodos = sharedPreference.getString(TODOS_LIST, null);
    if (listOfTodos == null)
        todos = new ArrayList<Todo>();
    else
        todos = gson.fromJson(listOfTodos, new TypeToken<ArrayList<Todo>>() {
        }.getType());
    return todos;
}

public void saveOnBackend() {
    // Connect to Backend solution

    // Get all local todos from preference
    // Save all at once in batches

    //OR

    // Get all local todos from preference
    // Save one by one
}
+1

Realm - ,

0

Azure, ToDo, , .

Azure mobile SDK - . SDK Sqlite wrapper storage, .

com.microsoft.windowsazure.mobileservices.table.sync.localstore.SQLiteLocalStore

, , .

SDK Android . , SDK . , pull , .

, MobileServiceSyncTable<YourClass> mTable

if (condition) 
{
  mTable.pull(queryTable,queryId).get();
}

queryTable . , mTable

Query queryTable = mClient.getTable(YourClass.class).select();

, , Azure. . SDK ,

pull. .

iOS Azure SDK iOS.

mTable.read(queryTable).get();

, , - /, - SDK . -, . - , PLS,

Once you get access to the SDK and API links, the classes below can be considered important.

1) com.microsoft.windowsazure.mobileservices.MobileServiceClient
2) com.microsoft.windowsazure.mobileservices.table.sync.MobileServiceSyncTable
3) com.microsoft.windowsazure.mobileservices.table.sync.MobileServiceSyncContext
4) com.microsoft.windowsazure.mobileservices.table.sync.localstore.SQLiteLocalStore
5) com.microsoft.windowsazure.mobileservices.table.query.Query
0
source

you can read https://docs.aws.amazon.com/appsync/latest/devguide/building-a-client-app-reactnative.html

AWS AppSync supports offline mode and you can use the database for your application.

0
source

Source: https://habr.com/ru/post/1690431/


All Articles