首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Android上的AWS TVM时凭据已过期

使用Android上的AWS TVM时凭据已过期
EN

Stack Overflow用户
提问于 2013-06-28 06:56:36
回答 1查看 365关注 0票数 3

我使用的是AWS Android SDK示例应用程序UserPreferenceDemo中的一些代码。我让示例应用程序工作,以便它能够创建一个新的DynamoDB表。然而,当我尝试在我的应用程序中实现相同的代码时,我在AmazonClientManager类中得到了日志消息"Credentials were“,并且我的应用程序崩溃了。

下面是我用来创建表的代码。

代码语言:javascript
复制
final Button submit = (Button) findViewById(R.id.bSubmitComplete)
submit.setOnClickListener(new View.OnClickListener() {

    public void onClick(View v) {
        Log.i(TAG, "submitBttn clicked.");

        new DynamoDBManagerTask()
        .execute(DynamoDBManagerType.CREATE_TABLE);
    }
});

下面是记录消息的代码。

代码语言:javascript
复制
public Response validateCredentials() {

    Response ableToGetToken = Response.SUCCESSFUL;

    if (AmazonSharedPreferencesWrapper
            .areCredentialsExpired(this.sharedPreferences)) {

        synchronized (this) {

            if (AmazonSharedPreferencesWrapper
                    .areCredentialsExpired(this.sharedPreferences)) {

                Log.i(LOG_TAG, "Credentials were expired.");

                AmazonTVMClient tvm = new AmazonTVMClient( this.sharedPreferences, PropertyLoader.getInstance().getTokenVendingMachineURL(), PropertyLoader.getInstance().useSSL() );

                ableToGetToken = tvm.anonymousRegister();

                if (ableToGetToken.requestWasSuccessful()) {

                    ableToGetToken = tvm.getToken();

                    if (ableToGetToken.requestWasSuccessful()) {
                        Log.i(LOG_TAG, "Creating New Credentials.");
                        initClients();
                    }
                }
            }
        }

    } else if (ddb == null) {

        synchronized (this) {

            if (ddb == null) {

                Log.i(LOG_TAG, "Creating New Credentials.");
                initClients();
            }
        }
    }

    return ableToGetToken;
}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-06-28 09:42:08

简单的解决方法,愚蠢的问题,但我已经花了一段时间研究这个问题了。

已卸载并重新安装应用程序。现在它可以工作了

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17354588

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档