【问题标题】:Azure Mobile Service - Android hangs when trying to execute table queryAzure 移动服务 - 尝试执行表查询时 Android 挂起
【发布时间】:2018-12-26 21:25:19
【问题描述】:

我创建了新的 MobileServiceClient。我可以通过配置的身份提供者登录并让表格正常工作。

mUserLoginTable = mClient.getTable("User_Login", UserLogin.class);

当我尝试检查登录的用户是否存在于我的表中时发生问题。

第一个版本:

mUserLoginTable.where().field("facebook_id").eq(_user.getUserId()).execute().get();

第二版:

public boolean ChekIfGoogeUserExists() throws ExecutionException, InterruptedException {
            AsyncTask<Void, Void, Boolean> task = new AsyncTask<Void, Void, Boolean>(){
                @Override
                protected Boolean doInBackground(Void... params) {
                    try {
                        List<UserLogin> result;
                    ListenableFuture<MobileServiceList<UserLogin>> future  = mUserLoginTable.where().field("google_id").eq(_user.getUserId()).execute();
                        return future.get().isEmpty();
                    } catch (Exception exception) {
                        return false;
                    }

                }
            };
           return  runAsyncTask(task).get();

    }

似乎没有任何工作,android 只是挂起请帮助!

我使用 SqlServer 在我的天蓝色数据库中创建了 User_Login 表。然后我添加了带有“User_Login”名称的 Azure MobileService EasyTable。它从数据库中正确找到并映射了 User_Login 表(列是自动添加的)。现在访问设置为匿名。

我已经在 AppServiceEditor 中为 User_Login 定义了读取函数:

var table = module.exports = require('azure-mobile-apps').table();
table.read(function (context) {
     return context.execute();
 });

(默认情况下将其注释掉也无济于事)

【问题讨论】:

  • 添加后端跟踪 - 当您打开详细诊断日志记录时,日志会显示什么内容?另外,使用 fiddler 或类似工具查看通信 - 有问题的请求和响应是什么?
  • @Groth 在AppServiceEditor中编辑的User_Login的代码中似乎没有任何查询操作。有更新吗?

标签: android azure mobile azure-mobile-services


【解决方案1】:

有两个问题。 我使用的第一个 .inputfield("facebook_id") 正确的似乎是 .inputfield(val("facebook_id")) 第二次我使用 .get()在主线程上执行网络操作 它导致android应用程序冻结。感谢您的帮助!

【讨论】:

    猜你喜欢
    • 2013-01-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-27
    • 1970-01-01
    • 1970-01-01
    • 2016-03-19
    相关资源
    最近更新 更多